|
Server IP : 10.2.73.233 / Your IP : 216.73.216.223 Web Server : Apache/2.4.59 (Debian) System : Linux polon 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64 User : www-data ( 33) PHP Version : 5.6.40-64+0~20230107.71+debian10~1.gbp673146 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/ifk/web/protected/Common/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
class KDuty extends TActiveRecord
{
const TABLE='ifk_duties';
const TYPE_WEEKDAY = 1;
const TYPE_DAY = 2;
private $_id;
private $_type;
private $_user_id;
private $_day;
private $_time_start;
private $_time_end;
private $_notes;
/* select-time */
public $usertitle_id;
public $username;
public $sortcolumn = 0;
/**/
public function getId() {return $this->_id;}
public function setId($value) {$this->_id = TPropertyValue::ensureInteger($value);}
public function getType() {return $this->_type;}
public function setType($value) {$this->_type = TPropertyValue::ensureInteger($value);}
public function getUser_id() {return $this->_user_id;}
public function setUser_id($value) {$this->_user_id = TPropertyValue::ensureInteger($value);}
public function getDay() {return $this->_day;}
public function setDay($value) {$this->_day = TPropertyValue::ensureString($value);}
public function getTime_start() {return $this->_time_start;}
public function setTime_start($value) {$this->_time_start = TPropertyValue::ensureString($value);}
public function getTime_end() {return $this->_time_end;}
public function setTime_end($value) {$this->_time_end = TPropertyValue::ensureString($value);}
public function getNotes() {return $this->_notes;}
public function setNotes($value) {$this->_notes = TPropertyValue::ensureString($value);}
public function getTime_startH()
{
$time = explode(':', $this->time_start);
return $time[0];
}
public function getTime_startM()
{
$time = explode(':', $this->time_start);
return $time[1];
}
public function getTime_endH()
{
$time = explode(':', $this->time_end);
return $time[0];
}
public function getTime_endM()
{
$time = explode(':', $this->time_end);
return $time[1];
}
public function getDescription($showDay = true, $showHours = true, $showNotes = true) {
$descriptionParts = array();
if ($showDay) {
$dutyday = $this->day;
if ($dutyday < 6)
switch($this->day) {
case 1: $description = "poniedziałki"; break;
case 2: $description = "wtorki"; break;
case 3: $description = "środy"; break;
case 4: $description = "czwartki"; break;
case 5: $description = "piątki"; break;
} else {
$description = iconv('ISO-8859-2', 'UTF-8', (strftime("%e %B %G (%A)", strtotime($dutyday))));
}
$descriptionParts[] = $description;
}
if ($showHours) {
$description = $this->time_startH.":".$this->time_startM;
$description .= "–".$this->time_endH.":".$this->time_endM;
$descriptionParts[] = $description;
}
if ($showNotes && $this->notes != '')
$descriptionParts[] = " (".$this->notes.")";
return implode(', ', $descriptionParts);
}
public static function finder($className=__CLASS__)
{
return parent::finder($className);
}
}
?>