Revize 732
Přidáno uživatelem Michal Kliment před asi 14 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/mail.php | ||
---|---|---|
'your_work_delete_subject' => 'Vaše práce byla smazána',
|
||
'your_work_delete' => "Vaše práce s textem %s byla smazána uživatelem <b>%s</b>.<br /><br /> Prosím neodpovídejte na tuto zprávu, byla vygenerována automaticky systémem.",
|
||
|
||
'your_work_vote_add_subject' => "K vaší práci byl přidán hlas",
|
||
'your_work_vote_add' => "Uživatel <b>%s</b> přidal hlas k vaší práci. Prohlédnout si ji a zjistit stav hlasování můžete <b><a href='%s'>zde</a></b>.<br /><br /> Prosím neodpovídejte na tuto zprávu, byla vygenerována automaticky systémem.",
|
||
'your_work_approve_subject' => "Vaše práce byla schválena",
|
||
'your_work_approve' => "Uživatel <b>%s</b> přidal hlas k vaší práci a vaše práce byla schválena. Prohlédnout si ji můžete <b><a href='%s'>zde</a></b>.<br /><br /> Prosím neodpovídejte na tuto zprávu, byla vygenerována automaticky systémem.",
|
||
'your_work_reject_subject' => "Vaše práce byla zamítnuta",
|
||
'your_work_reject' => "Uživatel <b>%s</b> přidal hlas k vaší práci a vaše práce byla zamítnuta. Prohlédnout si ji můžete <b><a href='%s'>zde</a></b>.<br /><br /> Prosím neodpovídejte na tuto zprávu, byla vygenerována automaticky systémem.",
|
||
|
||
'work_add_subject' => 'Práce byla přidána',
|
||
'work_add' => "Do systému byla přidána práce uživatele <b>%s</b>. Prohlédnout si ji a hlasovat o ní můžete <b><a href='%s'>zde</a></b>.<br /><br /> Prosím neodpovídejte na tuto zprávu, byla vygenerována automaticky systémem.",
|
||
'work_update_subject' => 'Práce byla upravena',
|
||
... | ... | |
'work_delete_subject' => 'Práce byla smazána',
|
||
'work_delete' => "V systému byla smazána práce uživatele <b>%s</b> s textem %s.<br /><br /> Prosím neodpovídejte na tuto zprávu, byla vygenerována automaticky systémem.",
|
||
|
||
'work_vote_add_subject' => "Byl přidán hlas k práci",
|
||
'work_vote_add' => "Uživatel <b>%s</b> přidal hlas k práci uživatele <b>%s</b>. Prohlédnout si ji a hlasovat o ní můžete <b><a href='%s'>zde</a></b>.<br /><br /> Prosím neodpovídejte na tuto zprávu, byla vygenerována automaticky systémem.",
|
||
'work_approve_subject' => "Práce byla schválena",
|
||
'work_approve' => "Uživatel <b>%s</b> přidal hlas k práci uživatele <b>%s</b> a tato práce byla schválena. Prohlédnout si ji můžete <b><a href='%s'>zde</a></b>.<br /><br /> Prosím neodpovídejte na tuto zprávu, byla vygenerována automaticky systémem.",
|
||
'work_reject_subject' => "Práce byla zamítnuta",
|
||
'work_reject' => "Uživatel <b>%s</b> přidal hlas k práci uživatele <b>%s</b> a tato práce byla zamítnuta. Prohlédnout si ji můžete <b><a href='%s'>zde</a></b>.<br /><br /> Prosím neodpovídejte na tuto zprávu, byla vygenerována automaticky systémem.",
|
||
|
||
'phone_invoice_warning_subject' => 'Účet za telefoní číslo %s v oddobí od %s do %s',
|
||
'phone_invoice_warning' => "Do systému byla přidána telefoní faktura, na níž se nachází i Vaše číslo %s.<br /><br />V rozhraní <a href='%s'><b>Moje telefoní účty</b></a> prosím vyplňte, které telefonní hovory a služby byly soukromé a firemní.",
|
||
);
|
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'vote has been successfully added' => 'Hlas byl úspěšně přidán.',
|
||
'vote has been successfully deleted' => 'Hlas byl úspěšně smazán.',
|
||
'vote has been successfully updated' => 'Hlas byl úspěšně aktualizován.',
|
||
'vote to work has been added' => 'Byl přidán hlas k práci',
|
||
'vote to your work has been added' => 'K vaší práci byl přidán hlas',
|
||
'votes has been successfully updated' => 'Hlasy byly úspěšně aktualizovány.',
|
||
'welcome to freenetis' => 'Vítejte ve FreeNetISu','voicemail password for voip account' => 'Heslo hlasové schránky pro VoIP účet',
|
||
'welcome to freenetis installation' => 'Vítejte ve FreeNetIS instalaci.',
|
||
... | ... | |
'work approval' => 'Schválení práce',
|
||
'work confirmation' => 'Potvrzení práce',
|
||
'work has been added' => 'Byla přidána práce',
|
||
'work has been approved' => 'Práce byla schválena',
|
||
'work has been deleted' => 'Byla smazána práce',
|
||
'work has been rejected' => 'Práce byla zamítnuta',
|
||
'work has been successfully added' => 'Práce byla úspěšně přidána',
|
||
'work has been successfully confirmed' => 'Práce byla úspěšně potvrzena',
|
||
'work has been successfully deleted' => 'Práce byla úspěšně smazána',
|
||
... | ... | |
'your mysql password' => 'Vaše MySQL heslo.',
|
||
'your mysql username' => 'Vaše MySQL uživatelské jméno.',
|
||
'your work has been added' => 'Vaše práce byla přidána',
|
||
'your work has been approved' => 'Vaše práce byla schválena',
|
||
'your work has been deleted' => 'Vaše práce byla smazána',
|
||
'your work has been rejected' => 'Vaše práce byla zamítnuta',
|
||
'your work has been updated' => 'Vaše práce byla aktualizována',
|
||
'zip code' => 'PSČ',
|
||
'zip_code' => 'PSČ'
|
freenetis/trunk/kohana/application/i18n/en_US/mail.php | ||
---|---|---|
'your_work_delete_subject' => 'Your work has been deleted',
|
||
'your_work_delete' => "Your work with text %s was deleted by user <b>%s</b>.<br /><br />Please don not react on this message, it was automatically generated by system.",
|
||
|
||
'your_work_vote_add_subject' => "Vote to your work has been added",
|
||
'your_work_vote_add' => "User <b>%s</b> added vote to your work. Check the state of voting or view work you can <b><a href='%s'>here</a></b>.<br /><br /> Please don not react on this message, it was automatically generated by system.",
|
||
'your_work_approve_subject' => "Your work has been approved",
|
||
'your_work_approve' => "User <b>%s</b> added vote to your work and your work has been approved. View work you can <b><a href='%s'>here</a></b>.<br /><br /> Please don not react on this message, it was automatically generated by system.",
|
||
'your_work_reject_subject' => "Your work has been rejected",
|
||
'your_work_reject' => "User <b>%s</b> added vote to your work and your work has been rejected. View work you can <b><a href='%s'>here</a></b>.<br /><br /> Please don not react on this message, it was automatically generated by system.",
|
||
|
||
'work_add_subject' => 'Work has been added',
|
||
'work_add' => "User work was added to th system <b>%s</b>. Vote or view work you can <b><a href='%s'>here</a></b>.<br /><br />Please don not react on this message, it was automatically generated by system.",
|
||
'work_add' => "User work was added to the system <b>%s</b>. Vote or view work you can <b><a href='%s'>here</a></b>.<br /><br />Please don not react on this message, it was automatically generated by system.",
|
||
'work_update_subject' => 'Work has been updated',
|
||
'work_update' => "In the system was updated user work <b>%s</b>. Vote or view work you can <b><a href='%s'>here</a></b>.<br /><br />Please don not react on this message, it was automatically generated by system.",
|
||
'work_delete_subject' => 'Work has been deleted',
|
||
'work_delete' => "In the system was deleted user work <b>%s</b> with text %s.<br /><br />Please don not react on this message, it was automatically generated by system.",
|
||
|
||
'work_vote_add_subject' => "Vote to work has been added",
|
||
'work_vote_add' => "User <b>%s</b> added vote to work of user <b>%s</b>. Vote or view work you can <b><a href='%s'>here</a></b>.<br /><br /> Please don not react on this message, it was automatically generated by system.",
|
||
'work_approve_subject' => "Work has been approved",
|
||
'work_approve' => "User <b>%s</b> added vote to work of user <b>%s</b> and this work has been approved. View work you can <b><a href='%s'>here</a></b>.<br /><br /> Please don not react on this message, it was automatically generated by system.",
|
||
'work_reject_subject' => "Work has been rejected",
|
||
'work_reject' => "User <b>%s</b> added vote to work of user <b>%s</b> and this work has been rejected. View work you can <b><a href='%s'>here</a></b>.<br /><br /> Please don not react on this message, it was automatically generated by system.",
|
||
|
||
'phone_invoice_warning_subject' => 'Phone invoice for number %s in period from %s to %s',
|
||
'phone_invoice_warning' => "To the system was added phone invoice, which contains your phone number %s.<br /><br />In interface <a href='%s'><b>My phone invoices</b></a> please fill, which phone calls and services was private and which company.",
|
||
);
|
freenetis/trunk/kohana/application/helpers/date.php | ||
---|---|---|
* @param string $date2
|
||
* @return array
|
||
*/
|
||
public static function interval($date1, $date2)
|
||
public static function interval($date1, $date2 = '0000-00-00 00:00:00')
|
||
{
|
||
// vars declaration
|
||
$interval = array(
|
||
... | ... | |
$time1 = $pd1['hour']*60*60 + $pd1['minute']*60 + $pd1['second'];
|
||
$time2 = $pd2['hour']*60*60 + $pd2['minute']*60 + $pd2['second'];
|
||
|
||
if ($time1 > $time2)
|
||
if ($time2 > $time1)
|
||
{
|
||
$diff = $time1-$time2;
|
||
$diff = $time2-$time1;
|
||
$invert_hour = floor($diff/3600);
|
||
$diff %= 3600;
|
||
$invert_minute = floor($diff/60);
|
||
... | ... | |
}
|
||
else
|
||
{
|
||
$diff = $time2-$time1;
|
||
$diff = $time1-$time2;
|
||
$interval['h'] = floor($diff/3600);
|
||
$diff %= 3600;
|
||
$interval['i'] = floor($diff/60);
|
||
$interval['s'] = $diff % 60;
|
||
}
|
||
|
||
if (($pd1['day'] < $pd2['day']))
|
||
if (($pd2['day'] < $pd1['day']))
|
||
{
|
||
$interval['d'] = $pd2['day'] - $pd1['day'];
|
||
$interval['d'] = $pd1['day'] - $pd2['day'];
|
||
}
|
||
else if (($pd1['day'] > $pd2['day']) || $pd1['day'] > $pd2['day'] && $time1 > $time2)
|
||
else if (($pd2['day'] > $pd1['day']) || $pd2['day'] > $pd1['day'] && $time2 > $time1)
|
||
{
|
||
$interval['d'] = count(date::days($pd1['month'],$pd1['year'])) - $pd1['day'] + $pd2['day'];
|
||
$pd1['month']++;
|
||
$interval['d'] = count(date::days($pd2['month'],$pd2['year'])) - $pd2['day'] + $pd1['day'];
|
||
$pd2['month']++;
|
||
}
|
||
|
||
if ($time1 > $time2)
|
||
if ($time2 > $time1)
|
||
$interval['d']--;
|
||
|
||
$interval['days'] = $interval['d'];
|
||
|
||
while($pd1['year'] <= $pd2['year'])
|
||
while($pd2['year'] <= $pd1['year'])
|
||
{
|
||
while(($pd1['year'] < $pd2['year'] && $pd1['month'] <= 12) || ($pd1['year'] == $pd2['year'] && $pd1['month'] < $pd2['month']))
|
||
while(($pd2['year'] < $pd1['year'] && $pd2['month'] <= 12) || ($pd2['year'] == $pd1['year'] && $pd2['month'] < $pd1['month']))
|
||
{
|
||
$interval['days'] += count(date::days($pd1['month'],$pd1['year']));
|
||
$interval['days'] += count(date::days($pd2['month'],$pd2['year']));
|
||
$interval['m']++;
|
||
$pd1['month']++;
|
||
$pd2['month']++;
|
||
}
|
||
$pd1['month'] = 1;
|
||
$pd1['year']++;
|
||
$pd2['month'] = 1;
|
||
$pd2['year']++;
|
||
}
|
||
|
||
$interval['y'] = floor($interval['m'] / 12);
|
||
... | ... | |
|
||
/**
|
||
* @author Michal Kliment
|
||
* Function to get day diff between datetime and current datetime
|
||
* Function to get day diff between 2 datetimes
|
||
* @param string $datetime
|
||
* @return number
|
||
*/
|
||
public static function day_diff($datetime)
|
||
public static function day_diff($date1, $date2 = '0000-00-00 00:00:00')
|
||
{
|
||
$interval = date::interval($datetime, date('Y-m-d H:i:s'));
|
||
$interval = date::interval($date1, $date2);
|
||
return $interval['days'];
|
||
}
|
||
|
||
/**
|
||
* @author Michal Kliment
|
||
* Function to get hour diff between datetime and current datetime
|
||
* Function to get hour diff between 2 datetimes
|
||
* @param string $datetime
|
||
* @return number
|
||
*/
|
||
public static function hour_diff($datetime)
|
||
public static function hour_diff($date1, $date2 = '0000-00-00 00:00:00')
|
||
{
|
||
$interval = date::interval($datetime, date('Y-m-d H:i:s'));
|
||
return $interval['h'];
|
||
$interval = date::interval($date1, $date2);
|
||
return $interval['days']*24 + $interval['h'];
|
||
}
|
||
|
||
/**
|
||
* @author Michal Kliment
|
||
* Function to get minute diff between datetime and current datetime
|
||
* Function to get minute diff between 2 datetimes
|
||
* @param string $datetime
|
||
* @return number
|
||
*/
|
||
public static function minute_diff($datetime)
|
||
public static function minute_diff($date1, $date2 = '0000-00-00 00:00:00')
|
||
{
|
||
$interval = date::interval($datetime, date('Y-m-d H:i:s'));
|
||
return $interval['i'];
|
||
$interval = date::interval($date1, $date2);
|
||
return ($interval['days']*24 + $interval['h'])*60 + $interval['i'];
|
||
}
|
||
|
||
} // End date
|
freenetis/trunk/kohana/application/models/member.php | ||
---|---|---|
<?php
|
||
<?php
|
||
/**
|
||
* @property integer $id
|
||
* @property integer $user_id
|
||
*/
|
||
class Member_Model extends ORM
|
||
{
|
||
protected $has_many = array('invoices', ' users', 'accounts',
|
||
... | ... | |
|
||
public function __construct($id = false)
|
||
{
|
||
parent::__construct($id);
|
||
parent::__construct($id);$this->
|
||
}
|
||
|
||
/**
|
freenetis/trunk/kohana/application/controllers/votes.php | ||
---|---|---|
if ($form->validate())
|
||
{
|
||
$form_data = $form->as_array();
|
||
$mail_message = new Mail_message_Model();
|
||
$user = new User_Model();
|
||
|
||
$vote = new Vote_Model();
|
||
$vote->user_id = $this->session->get('user_id');
|
||
... | ... | |
$vote->aro_group_id = $aro_group->id;
|
||
$vote->vote = $form_data['vote'];
|
||
$vote->comment = $form_data['comment'];
|
||
$vote->time = date('Y-m-d H:i:s');
|
||
$vote->save();
|
||
|
||
$work->state = $this->get_state($work, Vote_Model::$work);
|
||
... | ... | |
$work->transfer_id = $transfer->id;
|
||
}
|
||
|
||
// saves work
|
||
$work->save();
|
||
|
||
// is not necessary send message to user who voted about his work
|
||
if ($vote->user_id != $work->user_id)
|
||
{
|
||
$user->clear();
|
||
$user->where('id', $vote->user_id)->find();
|
||
|
||
switch ($work->state)
|
||
{
|
||
// work is pending
|
||
case 1:
|
||
$your_subject = mail_message::format('your_work_vote_add_subject');
|
||
$your_body = mail_message::format('your_work_vote_add', array($user->name.' '.$user->surname, url_lang::base().'works/show/'.$work->id));
|
||
break;
|
||
|
||
// work is rejected
|
||
case 2:
|
||
$your_subject = mail_message::format('your_work_reject_subject');
|
||
$your_body = mail_message::format('your_work_reject', array($user->name.' '.$user->surname, url_lang::base().'works/show/'.$work->id));
|
||
break;
|
||
|
||
// work is approved
|
||
case 3:
|
||
$your_subject = mail_message::format('your_work_approved_subject');
|
||
$your_body = mail_message::format('your_work_approved', array($user->name.' '.$user->surname, url_lang::base().'works/show/'.$work->id));
|
||
break;
|
||
}
|
||
|
||
$mail_message->clear();
|
||
$mail_message->from_id = 1;
|
||
$mail_message->to_id = $work->user_id;
|
||
$mail_message->subject = $your_subject;
|
||
$mail_message->body = $your_body;
|
||
$mail_message->time = date('Y-m-d H:i:s');
|
||
$mail_message->from_deleted = 1;
|
||
$mail_message->save();
|
||
}
|
||
|
||
// finds all aro ids assigned to vote about this work
|
||
$aro_ids = $approval_template_item_model->get_aro_ids_by_approval_template_id($work->approval_template_id, $work->suggest_amount);
|
||
|
||
// count of aro ids is not null
|
||
if (count($aro_ids))
|
||
{
|
||
// finds user to whom belongs work
|
||
$user->clear();
|
||
$user->where('id', $work->user_id)->find();
|
||
$work_user = $user->name.' '.$user->surname;
|
||
|
||
$user->clear();
|
||
$user->where('id', $vote->user_id)->find();
|
||
$vote_user = $user->name.' '.$user->surname;
|
||
|
||
switch ($work->state)
|
||
{
|
||
// work is pending
|
||
case 1;
|
||
$subject = mail_message::format('work_vote_add_subject');
|
||
$body = mail_message::format('work_vote_add', array($vote_user, $work_user, url_lang::base().'works/show/'.$work->id));
|
||
break;
|
||
|
||
// work is rejected
|
||
case 2:
|
||
$subject = mail_message::format('work_reject_subject');
|
||
$body = mail_message::format('work_reject', array($vote_user, $work_user, url_lang::base().'works/show/'.$work->id));
|
||
break;
|
||
|
||
// work is approved
|
||
case 3:
|
||
$subject = mail_message::format('work_approved_subject');
|
||
$body = mail_message::format('work_approved', array($vote_user, $work_user, url_lang::base().'works/show/'.$work->id));
|
||
break;
|
||
}
|
||
|
||
foreach ($aro_ids as $aro)
|
||
{
|
||
// is not necessary send message to user who added vote
|
||
if ($aro->id != $this->session->get('user_id'))
|
||
{
|
||
// sends message
|
||
$mail_message->clear();
|
||
$mail_message->from_id = 1;
|
||
$mail_message->to_id = $aro->id;
|
||
$mail_message->subject = $subject;
|
||
$mail_message->body = $body;
|
||
$mail_message->time = date('Y-m-d H:i:s');
|
||
$mail_message->from_deleted = 1;
|
||
$mail_message->save();
|
||
}
|
||
}
|
||
}
|
||
|
||
// set up state of approval template
|
||
$approval_template = new Approval_template_Model($work->approval_template_id);
|
||
$approval_template->state = $approval_template->get_state($approval_template->id);
|
||
... | ... | |
if ($form->validate())
|
||
{
|
||
$form_data = $form->as_array();
|
||
$mail_message = new Mail_message_Model();
|
||
$user = new User_Model();
|
||
|
||
$vote = new Vote_Model($vote_id);
|
||
$vote->vote = $form_data['vote'];
|
||
$vote->comment = $form_data['comment'];
|
||
$vote->time = date('Y-m-d H:i:s');
|
||
$vote->save();
|
||
|
||
switch ($vote->type)
|
||
... | ... | |
$work->transfer_id = $transfer->id;
|
||
}
|
||
|
||
// saves work
|
||
$work->save();
|
||
|
||
if ($work->state == 3)
|
||
{
|
||
$your_subject = url_lang::lang('texts.Your work has been approved');
|
||
$your_body = 'mail.your_work_approve';
|
||
|
||
$subject = url_lang::lang('texts.Work has been approved');
|
||
$body = 'mail.work_approve';
|
||
}
|
||
// work is rejected
|
||
else if ($work->state == 2)
|
||
{
|
||
$your_subject = url_lang::lang('texts.Your work has been rejected');
|
||
$your_body = 'mail.your_work_reject';
|
||
|
||
$subject = url_lang::lang('texts.Work has been rejected');
|
||
$body = 'mail.work_reject';
|
||
}
|
||
// work is pending
|
||
else
|
||
{
|
||
$your_subject = url_lang::lang('texts.Vote to your work has been updated');
|
||
$your_body = 'mail.your_work_vote_add';
|
||
|
||
$subject = url_lang::lang('texts.Vote to work has been updated');
|
||
$body = 'mail.work_vote_add';
|
||
}
|
||
|
||
// is not necessary send message to user who voted about his work
|
||
if ($vote->user_id != $work->user_id)
|
||
{
|
||
$user->clear();
|
||
$user->where('id', $vote->user_id)->find();
|
||
|
||
$mail_message->clear();
|
||
$mail_message->from_id = 1;
|
||
$mail_message->to_id = $work->user_id;
|
||
$mail_message->subject = $your_subject;
|
||
$mail_message->body = url_lang::lang($your_body, array($user->name.' '.$user->surname, url_lang::base().'works/show/'.$work->id));
|
||
$mail_message->time = date('Y-m-d H:i:s');
|
||
$mail_message->from_deleted = 1;
|
||
$mail_message->save();
|
||
}
|
||
|
||
// finds all aro ids assigned to vote about this work
|
||
$aro_ids = $approval_template_item_model->get_aro_ids_by_approval_template_id($work->approval_template_id, $work->suggest_amount);
|
||
|
||
// count of aro ids is not null
|
||
if (count($aro_ids))
|
||
{
|
||
// finds user to whom belongs work
|
||
$user->clear();
|
||
$user->where('id', $work->user_id)->find();
|
||
$work_user = $user->name.' '.$user->surname;
|
||
|
||
$user->clear();
|
||
$user->where('id', $vote->user_id)->find();
|
||
$vote_user = $user->name.' '.$user->surname;
|
||
|
||
$body = url_lang::lang($body, array($vote_user, $work_user, url_lang::base().'works/show/'.$work->id));
|
||
|
||
foreach ($aro_ids as $aro)
|
||
{
|
||
// is not necessary send message to user who edit vote
|
||
if ($aro->id != $this->session->get('user_id'))
|
||
{
|
||
// sends message
|
||
$mail_message->clear();
|
||
$mail_message->from_id = 1;
|
||
$mail_message->to_id = $aro->id;
|
||
$mail_message->subject = $subject;
|
||
$mail_message->body = $body;
|
||
$mail_message->time = date('Y-m-d H:i:s');
|
||
$mail_message->from_deleted = 1;
|
||
$mail_message->save();
|
||
}
|
||
}
|
||
}
|
||
|
||
// set up state of approval template
|
||
$approval_template = new Approval_template_Model($work->approval_template_id);
|
||
$approval_template->state = $approval_template->get_state($approval_template->id);
|
||
... | ... | |
|
||
if ((!$vote || !$vote->id))
|
||
{
|
||
$interval = date::interval($approval_template_item->approval_type->interval);
|
||
if (!$interval['h'])
|
||
$interval = date::hour_diff($approval_template_item->approval_type->interval);
|
||
if (!$interval)
|
||
$state = 1;
|
||
}
|
||
else
|
||
... | ... | |
}
|
||
else
|
||
{
|
||
$interval = date::interval($approval_template_item->approval_type->interval);
|
||
if ($interval['h'])
|
||
$interval = date::hour_diff($approval_template_item->approval_type->interval);
|
||
if ($interval)
|
||
{
|
||
$count -= $abstain;
|
||
|
freenetis/trunk/kohana/application/controllers/works.php | ||
---|---|---|
{
|
||
$vote->vote = $post_vote;
|
||
$vote->comment = $comments[$id];
|
||
$vote->time = date('Y-m-d H:i:s');
|
||
$vote->save();
|
||
}
|
||
// create vote
|
||
... | ... | |
$vote->type = Vote_Model::$work;
|
||
$vote->vote = $post_vote;
|
||
$vote->comment = $comments[$id];
|
||
$vote->time = date('Y-m-d H:i:s');
|
||
$vote->save();
|
||
}
|
||
|
||
... | ... | |
{
|
||
$vote->vote = $post_vote;
|
||
$vote->comment = $comments[$id];
|
||
$vote->time = date('Y-m-d H:i:s');
|
||
$vote->save();
|
||
}
|
||
// create vote
|
||
... | ... | |
$vote->type = Vote_Model::$work;
|
||
$vote->vote = $post_vote;
|
||
$vote->comment = $comments[$id];
|
||
$vote->time = date('Y-m-d H:i:s');
|
||
$vote->save();
|
||
}
|
||
|
||
... | ... | |
$vote_groups[$i] = $aro_group->name;
|
||
|
||
$vote_model = new Vote_Model();
|
||
$votes = $vote_model->select('votes.id', 'votes.user_id', 'CONCAT(users.name,\' \',users.surname) as uname', 'vote', 'votes.comment')->join('users','users.id = votes.user_id')->where('votes.type',Vote_Model::$work)->where('fk_id',$work->id)->where('aro_group_id', $aro_group->id)->find_all();
|
||
$votes = $vote_model->select('votes.id', 'votes.user_id', 'CONCAT(users.name,\' \',users.surname) as uname', 'vote', 'votes.comment', 'time')->join('users','users.id = votes.user_id')->where('votes.type',Vote_Model::$work)->where('fk_id',$work->id)->where('aro_group_id', $aro_group->id)->find_all();
|
||
|
||
$total_votes[$i] = count($votes);
|
||
$sums[$i] = 0;
|
||
... | ... | |
$vote_grids[$i]->callback_field('user_id')->label(url_lang::lang('texts.User'))->callback('Works_Controller::user_name');
|
||
$vote_grids[$i]->callback_field('vote')->label(url_lang::lang('texts.Vote'))->callback('Works_Controller::vote');
|
||
$vote_grids[$i]->callback_field('comment')->label(url_lang::lang('texts.Comment'))->callback('Works_Controller::comment_field');
|
||
$vote_grids[$i]->callback_field('time')->label(url_lang::lang('texts.Time'))->callback('Works_Controller::time_field');
|
||
$vote_grids[$i]->callback_field('id')->label(url_lang::lang('texts.Edit'))->callback('Works_Controller::edit_field');
|
||
$vote_grids[$i]->callback_field('id')->label(url_lang::lang('texts.Delete'))->callback('Works_Controller::delete_field');
|
||
|
||
... | ... | |
{
|
||
$vote_groups[$i] = $aro_group->name;
|
||
|
||
$votes = $vote_model->select('votes.id', 'votes.user_id', 'CONCAT(users.name,\' \',users.surname) as uname', 'vote', 'votes.comment')->join('users','users.id = votes.user_id')->where('votes.type',Vote_Model::$work)->where('fk_id',$work->id)->where('aro_group_id', $aro_group->id)->find_all();
|
||
$votes = $vote_model->select('votes.id', 'votes.user_id', 'CONCAT(users.name,\' \',users.surname) as uname', 'vote', 'votes.comment', 'time')->join('users','users.id = votes.user_id')->where('votes.type',Vote_Model::$work)->where('fk_id',$work->id)->where('aro_group_id', $aro_group->id)->find_all();
|
||
|
||
$total_votes[$i] = count($votes);
|
||
$sums[$i] = 0;
|
||
... | ... | |
$vote_grids[$i]->callback_field('user_id')->label(url_lang::lang('texts.User'))->callback('Works_Controller::user_name');
|
||
$vote_grids[$i]->callback_field('vote')->label(url_lang::lang('texts.Vote'))->callback('Works_Controller::vote');
|
||
$vote_grids[$i]->callback_field('comment')->label(url_lang::lang('texts.Comment'))->callback('Works_Controller::comment_field');
|
||
$vote_grids[$i]->callback_field('time')->label(url_lang::lang('texts.Time'))->callback('Works_Controller::time_field');
|
||
|
||
if ($work->state < 2)
|
||
{
|
||
$vote_grids[$i]->callback_field('id')->label(url_lang::lang('texts.Edit'))->callback('Works_Controller::edit_field');
|
||
$vote_grids[$i]->callback_field('id')->label(url_lang::lang('texts.Delete'))->callback('Works_Controller::delete_field');
|
||
}
|
||
|
||
$vote_grids[$i]->datasource($votes);
|
||
|
||
$percents[$i] = ($total_votes[$i]) ? round($agrees[$i] / $total_votes[$i] * 100, 1) : 0;
|
||
... | ... | |
// creates new work
|
||
$work = new Job_Model();
|
||
$work->user_id = $form_data['user_id'];
|
||
$work->added_by_id = $this->session->get('user_id');
|
||
$work->description = $form_data['description'];
|
||
$work->suggest_amount = $form_data['suggest_amount'];
|
||
$work->date = date('Y-m-d', $form_data['date']);
|
||
... | ... | |
$user->clear();
|
||
$user->where('id', $work->user_id)->find();
|
||
|
||
$subject = mail_message::format('ork_add_subject');
|
||
$subject = mail_message::format('work_add_subject');
|
||
$body = mail_message::format('work_add', array($user->name.' '.$user->surname,url_lang::base().'works/show/'.$work->id));
|
||
|
||
foreach ($aro_ids as $aro)
|
||
... | ... | |
// creates new work
|
||
$work = new Job_Model($work_id);
|
||
$work->user_id = $form_data['user_id'];
|
||
$work->added_by_id = $this->session->get('user_id');
|
||
$work->description = $form_data['description'];
|
||
$work->date = date('Y-m-d', $form_data['date']);
|
||
$work->hours = $form_data['hours'];
|
||
... | ... | |
|
||
/**
|
||
* @author Michal Kliment
|
||
* Callback function to show datetime in human format
|
||
* @param <type> $item
|
||
* @param <type> $name
|
||
*/
|
||
public static function time_field ($item, $name)
|
||
{
|
||
echo date::pretty($item->time).' '.date::pretty_time($item->time);
|
||
}
|
||
|
||
/**
|
||
* @author Michal Kliment
|
||
* Callback function to show vote as image
|
||
* @param <type> $item
|
||
* @param <type> $name
|
freenetis/trunk/kohana/application/views/mail_messages_show.php | ||
---|---|---|
<th><?php echo url_lang::lang('texts.Time') ?></th>
|
||
<td style="width: 610px;"><?php echo date::mail_time($message->time) ?>
|
||
<?php
|
||
if (date::day_diff($message->time) == 1)
|
||
if (date::day_diff(date('Y-m-d H:i:s'), $message->time) == 1)
|
||
echo '('.url_lang::lang('texts.1 day ago').')';
|
||
else if (date::day_diff($message->time) > 1 && date::day_diff($message->time) < 14)
|
||
echo '('.url_lang::lang('texts.%s days ago', date::day_diff($message->time)).')';
|
||
else if (date::day_diff($message->time) == 0)
|
||
else if (date::day_diff(date('Y-m-d H:i:s'), $message->time) > 1 && date::day_diff(date('Y-m-d H:i:s'), $message->time) < 14)
|
||
echo '('.url_lang::lang('texts.%s days ago', date::day_diff(date('Y-m-d H:i:s'), $message->time)).')';
|
||
else if (date::day_diff(date('Y-m-d H:i:s'), $message->time) == 0)
|
||
{
|
||
if (date::hour_diff($message->time) == 1)
|
||
if (date::hour_diff(date('Y-m-d H:i:s'), $message->time) == 1)
|
||
echo '('.url_lang::lang('texts.1 hour ago').')';
|
||
else if (date::hour_diff($message->time) > 1)
|
||
echo '('.url_lang::lang('texts.%s hours ago', date::hour_diff($message->time)).')';
|
||
else if (date::hour_diff($message->time) == 0)
|
||
else if (date::hour_diff(date('Y-m-d H:i:s'), $message->time) > 1)
|
||
echo '('.url_lang::lang('texts.%s hours ago', date::hour_diff(date('Y-m-d H:i:s'), $message->time)).')';
|
||
else if (date::hour_diff(date('Y-m-d H:i:s'), $message->time) == 0)
|
||
{
|
||
if (date::minute_diff($message->time) <= 1)
|
||
if (date::minute_diff(date('Y-m-d H:i:s'), $message->time) <= 1)
|
||
echo '('.url_lang::lang('texts.1 minute ago').')';
|
||
else
|
||
echo '('.url_lang::lang('texts.%s minutes ago', date::minute_diff($message->time)).')';
|
||
echo '('.url_lang::lang('texts.%s minutes ago', date::minute_diff(date('Y-m-d H:i:s'), $message->time)).')';
|
||
}
|
||
}
|
||
?></td>
|
Také k dispozici: Unified diff
Commit zmen, ktere jsem udelal jeste pred nastupem do skoly a doted jsem nemel
cas je doresit. Snad to bude fungovat.