コード例 #1
0
 function draw()
 {
     $object = $this->popMailbox();
     if (!$object) {
         $object = new date();
         $object->timestamp = time();
         $object->parse();
     }
     //if (!$object) $object = new date(); $object->timestamp = 0; $object->parse();
     $out .= "<select name=\"" . ($this->__prefix ? $this->__prefix . "_" : "") . $this->selector_day . "\">";
     $out .= "<option value=\"0\" " . ($object->string == "N/A" ? "selected" : "") . ">--</option>";
     for ($i = 1; $i < 32; $i++) {
         $out .= "\n\t<option value=\"" . $i . "\" " . ($object->day == $i ? "selected" : "") . ">" . $i . "</option>";
     }
     $out .= "</select>";
     $out .= "<select name=\"" . ($this->__prefix ? $this->__prefix . "_" : "") . $this->selector_month . "\">";
     $out .= "<option value=\"0\" " . ($object->string == "N/A" ? "selected" : "") . ">--</option>";
     for ($i = 1; $i < 13; $i++) {
         $out .= "\n\t<option value=\"" . $i . "\" " . ($object->month == $i ? "selected" : "") . ">" . $object->__months[$i] . "</option>";
     }
     $out .= "</select>";
     $out .= "<select name=\"" . ($this->__prefix ? $this->__prefix . "_" : "") . $this->selector_year . "\">";
     $out .= "<option value=\"0\" " . ($object->string == "N/A" ? "selected" : "") . ">--</option>";
     for ($i = 1970; $i < 2020; $i++) {
         $out .= "\n\t<option value=\"" . $i . "\" " . ($object->year == $i ? "selected" : "") . ">" . $i . "</option>";
     }
     $out .= "</select>";
     //$out .="<input type=\"text\" name=\"".($this->__prefix ? $this->__prefix."_" : "").$this->selector_hour."\" value=\"".$object->hour."\" size=\"2\"> : <input type=\"text\" name=\"".($this->__prefix ? $this->__prefix."_" : "").$this->selector_minutes."\" value=\"".$object->minutes."\" size=\"2\">";
     return $out;
 }
コード例 #2
0
 function datestring($timestamp)
 {
     $d = new date();
     $d->timestamp = $timestamp;
     $d->parse();
     $this->timestamp = $timestamp;
     $this->string = $d->string;
 }
コード例 #3
0
 function test_new_host_new_day()
 {
     $this->test_new_host();
     $date = new date();
     $date->set_by_days($date->date_to_days() + 1);
     $this->stats_counter->set_new_host();
     $this->stats_counter->update($date);
     $this->_check_stats_counter_record($hits_all = 2, $hits_today = 1, $hosts_all = 2, $hosts_today = 1, $date);
     $this->_check_stats_day_counters_record($hits_today, $hosts_today, $home_hits = 0, $audience_host = 0, $date);
     $this->_check_counters_consistency($date);
 }
コード例 #4
0
 function test_same_host_wrong_day()
 {
     $date1 = new date();
     $ip = ip::encode_ip('192.168.0.5');
     $this->stats_ip->setReturnValue('get_client_ip', $ip);
     $this->stats_ip->is_new_host($date1);
     $date2 = new date();
     $date2->set_by_days($date1->date_to_days() - 2);
     $this->stats_ip->setReturnValueAt(1, 'get_client_ip', $ip);
     $this->assertFalse($this->stats_ip->is_new_host($date2));
     $this->_check_stats_ip_record($total_records = 1, $ip, $date1);
 }
コード例 #5
0
ファイル: encrypt.php プロジェクト: CRIDIP-SWD/GAMESHOP
 /**
  * Permet de créer un TOKEN sous la base Encrypteur NOCTUS, il est vérifier et déchiffrer par le décrypteur NOCTUS
  * @return string
  */
 public function new_token()
 {
     $date_format = new date();
     $date = $date_format->format_strt("d-m-Y H:i:s");
     $username = $this->username;
     $password = $this->password;
     $chaine = "azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN&0123456789_@";
     $shuff = str_shuffle($chaine);
     $key = substr($shuff, 0, 15);
     $token = $username . "_" . $key . "_" . $password . "_" . time();
     return $token;
 }
コード例 #6
0
ファイル: stats.php プロジェクト: sydlawrence/SocialFeed
 public function __visitor_count_month($date)
 {
     $start_date;
     $start = date('Y-m-d H:i', strtotime($date['year'] . "-" . $date['month'] . "-01 00:00"));
     $final_date = $this->_plus_month($date);
     $end = date('Y-m-d H:i', strtotime($final_date['year'] . "-" . $final_date['month'] . "-01 00:00"));
     $html = "";
     $html .= "<p>total visits: " . stats::get_visitor_count($start, $end) . "</p>";
     $html .= "<p>unique visitors: " . stats::get_visitor_count($start, $end, true) . "</p>";
     $views = array();
     $unique = array();
     foreach (date::days($date['month'], $date['year']) as $day) {
         $start = date('Y-m-d H:i', strtotime($date['year'] . "-" . $date['month'] . "-" . $day . " 00:00"));
         $end_day = $day + 1;
         if (count(date::days($date['month'], $date['year'])) < $end_day) {
             $end = date('Y-m-d H:i', strtotime($final_date['year'] . "-" . $final_date['month'] . "-01 00:00"));
         } else {
             $end = date('Y-m-d H:i', strtotime($date['year'] . "-" . $date['month'] . "-" . ($day + 1) . " 00:00"));
         }
         $count = stats::get_visitor_count($start, $end);
         $views[$day] = $count;
         $count = stats::get_visitor_count($start, $end, true);
         $unique[$day] = $count;
     }
     $chart = new GoogChart();
     $dataMultiple = array("Page views" => $views, "Unique visitors" => $unique);
     $min = 0;
     $max = 10;
     //	chxr='y',$min,$max,(($max-$min)/10);
     /* # Chart 2 # */
     $chart->setChartAttrs(array('type' => 'line', 'title' => 'Visits for ' . date('F Y', strtotime($start)), 'data' => $dataMultiple, 'size' => array(750, 200), 'labelsXY' => true, 'color' => array('#27aae1', '#e127aa')));
     // Print chart
     $html .= $chart;
     return $html;
 }
コード例 #7
0
ファイル: duration.php プロジェクト: LupusMichaelis/horn
 public function __construct($year, $weekno)
 {
     $this->week = $weekno;
     $this->year = $year;
     $day = date::new_from_format("{$year}-W{$weekno}");
     $this->push($day);
     while ($day->get_day_of_week() != 7) {
         $day = $day->tomorrow();
         $this->push($day);
     }
     // The day can be any day in a week. So we start to push
     // the asked day, then we push comming days, then we revert the day's storage, then we push
     // the passed days until the first, and revert the storage.
     /*
     $aday = $day;
     $this->push($aday);
     
     while($aday->get_day_of_week() != 7)
     {
     	$aday = $aday->tomorrow();
     	$this->push($aday);
     }
     
     $this->reverse();
     $aday = $day;
     
     while($aday->get_day_of_week() != 1)
     {
     	$aday = $aday->yesterday();
     	$this->push($aday);
     }
     
     $this->reverse();
     */
 }
コード例 #8
0
ファイル: Plan.php プロジェクト: miteshchavada/clubmaster
 /**
  * Get end
  *
  * @return \DateTime
  */
 public function getEnd()
 {
     if ($this->getAllDay()) {
         $this->end->setTime(23, 59, 59);
     }
     return $this->end;
 }
 function _set_period_filter()
 {
     $locale =& locale::instance();
     $start_date = new date();
     $start_date->set_hour(0);
     $start_date->set_minute(0);
     $start_date->set_second(0);
     if (isset($_REQUEST['stats_start_date'])) {
         $start_date->set_by_string($_REQUEST['stats_start_date'], $locale->get_short_date_time_format());
     }
     $finish_date = new date();
     if (isset($_REQUEST['stats_finish_date'])) {
         $finish_date->set_by_string($_REQUEST['stats_finish_date'], $locale->get_short_date_time_format());
     }
     $this->stats_report->set_period_filter($start_date, $finish_date);
 }
コード例 #10
0
ファイル: MY_ORM.php プロジェクト: ready4god2513/Journal
 /**
  * Output dates as friendly dates
  * @developer Brandon Hansen
  * @date May 16, 2010
  */
 public function __get($key)
 {
     if (in_array($key, array('created_at', 'modified_at'))) {
         return date::full_date_time(parent::__get($key));
     } else {
         return parent::__get($key);
     }
 }
コード例 #11
0
 public function getStartTimestamp()
 {
     if ($this->startDate) {
         return strval($this->startDate->getTimestamp());
     } else {
         return "";
     }
 }
コード例 #12
0
ファイル: MY_date.php プロジェクト: hiltongoncalves/SAPO
 public function week_days($year = FALSE, $week = FALSE)
 {
     $w = date::week($year, $week);
     $list = array();
     for ($day = 0; $day <= 6; $day++) {
         $list[] = date('Y-m-d', strtotime($w['year'] . "W" . $w['week'] . $day));
     }
     return $list;
 }
コード例 #13
0
ファイル: journals.php プロジェクト: ready4god2513/Journal
 /**
  * Make sure that the one to update belongs to the user
  * @Developer brandon
  * @Date May 19, 2010
  */
 public function edit($id = NULL)
 {
     $journal = ORM::factory('journal', $id);
     if ($journal->user->id != user::current()->id) {
         url::redirect('');
     }
     meta::set_title(date::user_friendly_date($journal->created_at) . ' : ' . $journal->title);
     parent::edit($id);
 }
コード例 #14
0
ファイル: procedimento.php プロジェクト: hiltongoncalves/SAPO
 public function lista_semana()
 {
     $semana = date::week_days();
     //echo Kohana::debug($semana);
     $lista = array();
     foreach ($semana as $dia) {
         $lista[$dia] = ORM::Factory('procedimento')->where('data', $dia)->find_all();
     }
     return $lista;
 }
コード例 #15
0
ファイル: Form_Dateselect.php プロジェクト: JasonWiki/docs
 protected function load_value()
 {
     if (is_bool($this->valid)) {
         return;
     }
     $time = $this->input_value($this->name);
     // Make sure all the required inputs keys are set
     $time += $this->time_array(time());
     $this->data['value'] = mktime(date::adjust($time['hour'], $time['am_pm']), $time['minute'], 0, $time['month'], $time['day'], $time['year']);
 }
コード例 #16
0
ファイル: Project.php プロジェクト: jackbravo/symfony-sandbox
 /**
  * Set estimated_end_date
  *
  * @param date $estimated_end_date
  */
 public function setEstimatedEndDate($estimated_end_date)
 {
     if ($this->getId() && $this->estimated_end_date != $estimated_end_date) {
         $current = isset($this->estimated_end_date) ? $this->estimated_end_date->format('Y-m-d') : '';
         $this->getLastNote()->addChange("Estimated end date changed from '{$current}' to '{$estimated_end_date->format('Y-m-d')}'");
     }
     if ($this->getOriginalEstimatedEndDate() == null) {
         $this->setOriginalEstimatedEndDate($estimated_end_date);
     }
     $this->estimated_end_date = $estimated_end_date;
 }
コード例 #17
0
 function _get_mail_body($template_path)
 {
     $template = new template($template_path);
     $locale =& locale::instance();
     $date = new date();
     $template->set('date', $date->format($locale->get_short_date_format()));
     $cart =& cart::instance();
     $list =& $template->find_child('cart_items');
     $list->register_dataset($cart->get_items_array_dataset());
     $template->set('name', $this->dataspace->get('name'));
     $template->set('notes', $this->dataspace->get('notes'));
     $template->set('phone', $this->dataspace->get('phone'));
     $template->set('address', $this->dataspace->get('address'));
     $template->set('email', $this->dataspace->get('email'));
     ob_start();
     $template->display();
     $content = ob_get_contents();
     ob_end_clean();
     return $content;
 }
コード例 #18
0
ファイル: Email.php プロジェクト: ready4god2513/Journal
 /**
  * Send out the daily topic e-mail
  * @developer Brandon Hansen
  * @date May 25, 2010
  */
 public function send_daily_email()
 {
     if ($topic = ORM::factory('topic')->topic_of_the_day()) {
         $users = ORM::factory('user')->users_subscribed_to_topic_of_the_day();
         $this->subject = 'Topic of the Day for ' . date::user_friendly_date(date('Y-m-d'));
         $this->body = View::factory('emails/daily_topic')->set('topic', $topic)->render();
         foreach ($users as $user) {
             $this->recipient = $user->email;
             $this->send();
         }
     }
 }
  function _set_period_filter(&$request)
  {
    $locale =& locale :: instance();
    $start_date = new date();
    $start_date->set_hour(0);
    $start_date->set_minute(0);
    $start_date->set_second(0);

    if ($stats_start_date = $request->get_attribute('stats_start_date'))
      $start_date->set_by_string($stats_start_date, $locale->get_short_date_time_format());

    $finish_date = new date();
    if ($stats_finish_date = $request->get_attribute('stats_finish_date'))
      $finish_date->set_by_string($stats_finish_date, $locale->get_short_date_time_format());

    $finish_date->set_hour(23);
    $finish_date->set_minute(59);
    $finish_date->set_second(59);

    $this->stats_report->set_period_filter($start_date, $finish_date);
  }
コード例 #20
0
ファイル: user.php プロジェクト: netbiel/core
 /**
  * Magic setter
  *
  * @param  string  $key
  * @param  mixed   $value
  */
 public function __set($key, $value)
 {
     switch ($key) {
         // Date of birth
         case 'dob':
             $value = date::format(date::DATE_SQL, $value);
             break;
             // Always lowercase e-mail
         // Always lowercase e-mail
         case 'email':
             $value = utf8::strtolower($value);
             break;
     }
     parent::__set($key, $value);
 }
コード例 #21
0
 /**
  * shortcut fot DateTime::createFromFormat
  * @param  string $date          
  * @param  string $input_format  
  * @param  string $output_format 
  * @return mixed                
  */
 public static function from_format($date, $input_format = 'd/m/yy', $output_format = 'm-d-Y')
 {
     if ($date === NULL) {
         $date = time();
     }
     $datetime = DateTime::createFromFormat($input_format, $date);
     switch ($output_format) {
         case 'unix':
             return date::unix2mysql($datetime->getTimestamp());
             break;
         default:
             return $datetime->format($output_format);
             break;
     }
 }
コード例 #22
0
ファイル: zip.php プロジェクト: BRMatt/kohana-archive
 public function add_data($file, $name, $contents = NULL)
 {
     // Determine the file type: 16 = dir, 32 = file
     $type = substr($file, -1) === '/' ? 16 : 32;
     // Fetch the timestamp, using the current time if manually setting the contents
     $timestamp = date::unix2dos($contents === NULL ? filemtime($file) : time());
     // Read the file or use the defined contents
     $data = $contents === NULL ? file_get_contents($file) : $contents;
     // Gzip the data, use substr to fix a CRC bug
     $zdata = substr(gzcompress($data), 2, -4);
     $this->data[] = "PK" . "" . "" . "" . pack('V', $timestamp) . pack('V', crc32($data)) . pack('V', strlen($zdata)) . pack('V', strlen($data)) . pack('v', strlen($name)) . pack('v', 0) . $name . $zdata;
     // Compressed data
     $this->dirs[] = "PK" . "" . "" . "" . "" . pack('V', $timestamp) . pack('V', crc32($data)) . pack('V', strlen($zdata)) . pack('V', strlen($data)) . pack('v', strlen($name)) . pack('v', 0) . pack('v', 0) . pack('v', 0) . pack('v', 0) . pack('V', $type) . pack('V', $this->offset) . $name;
     // File name
     // Set the new offset
     $this->offset = strlen(implode('', $this->data));
 }
コード例 #23
0
ファイル: model.php プロジェクト: leowh/crm
 /** 
  * Get customer list.
  * 
  * @param  string  $mode 
  * @param  mix     $param 
  * @param  string  $relation  client|provider
  * @param  string  $orderBy 
  * @param  object  $pager 
  * @access public
  * @return array
  */
 public function getList($mode = 'all', $param = null, $relation = 'client', $orderBy = 'id_desc', $pager = null)
 {
     $customerIdList = $this->getCustomersSawByMe();
     if (empty($customerIdList)) {
         return array();
     }
     $this->app->loadClass('date', $static = true);
     $thisMonth = date::getThisMonth();
     $thisWeek = date::getThisWeek();
     if ($this->session->customerQuery == false) {
         $this->session->set('customerQuery', ' 1 = 1');
     }
     $customerQuery = $this->loadModel('search', 'sys')->replaceDynamic($this->session->customerQuery);
     if (strpos($orderBy, 'id') === false) {
         $orderBy .= ', id_desc';
     }
     return $this->dao->select('*')->from(TABLE_CUSTOMER)->where('deleted')->eq(0)->beginIF($relation == 'client')->andWhere('relation')->ne('provider')->beginIF($relation == 'provider')->andWhere('relation')->ne('client')->beginIF($mode == 'field')->andWhere('mode')->eq($param)->fi()->beginIF($mode == 'past')->andWhere('nextDate')->lt(helper::today())->fi()->beginIF($mode == 'today')->andWhere('nextDate')->eq(helper::today())->fi()->beginIF($mode == 'tomorrow')->andWhere('nextDate')->eq(formattime(date::tomorrow(), DT_DATE1))->fi()->beginIF($mode == 'thisweek')->andWhere('nextDate')->between($thisWeek['begin'], $thisWeek['end'])->fi()->beginIF($mode == 'thismonth')->andWhere('nextDate')->between($thisMonth['begin'], $thisMonth['end'])->fi()->beginIF($mode == 'public')->andWhere('public')->eq('1')->fi()->beginIF($mode == 'assignedTo')->andWhere('assignedTo')->eq($this->app->user->account)->fi()->beginIF($mode == 'query')->andWhere($param)->fi()->beginIF($mode == 'bysearch')->andWhere($customerQuery)->fi()->beginIF(strpos('all, bysearch, public, assignedTo, query', $mode) === false)->andWhere('nextDate')->ne('0000-00-00')->fi()->andWhere('id')->in($customerIdList)->orderBy($orderBy)->page($pager)->fetchAll('id');
 }
コード例 #24
0
function processa_alteracao_faltas($alunos_faltas, $num_aulas)
{
    global $conn, $data_chamada, $sa_ref_pessoa, $periodo, $diario_id, $sem_faltas, $curso, $disciplina;
    $resposta = '';
    if (is_array($alunos_faltas) && count($alunos_faltas) > 0) {
        reset($alunos_faltas);
        foreach ($alunos_faltas as $reg_aluno => $num_faltas) {
            if ($num_faltas <= $num_aulas || empty($num_faltas) || $num_faltas == 0) {
                $aluno = $conn->get_one("SELECT nome FROM pessoas WHERE id = {$reg_aluno};");
                $aluno = '<font color="red"><b>' . $aluno . ' (' . $reg_aluno . ')</b></font>';
                if (registra_faltas($reg_aluno, $diario_id, abs($num_faltas), $data_chamada, $sa_ref_pessoa, TRUE) === TRUE) {
                    $resposta .= '<strong>' . abs($num_faltas) . '</strong> Falta(s) registrada(s) para ' . $aluno . ' no dia ' . date::convert_date($data_chamada) . '<br />';
                }
            }
        }
    }
    echo $resposta;
}
コード例 #25
0
ファイル: user.php プロジェクト: anqqa/Anqh
 /**
  * Magic setter
  *
  * @param  string  $key
  * @param  mixed   $value
  */
 public function __set($key, $value)
 {
     switch ($key) {
         // Date of birth
         case 'dob':
             $value = date::format(date::DATE_SQL, $value);
             break;
             // Always lowercase e-mail
         // Always lowercase e-mail
         case 'email':
             $value = utf8::strtolower($value);
             break;
             // Use Auth to hash the password
         // Use Auth to hash the password
         case 'password':
             $value = Visitor::instance()->hash_password($value);
             break;
     }
     parent::__set($key, $value);
 }
コード例 #26
0
ファイル: class.periode.php プロジェクト: wedesign-pf/Tit
 public function add($param = "")
 {
     global $formMaj;
     global $datas_lang;
     global $smarty;
     global $thisSite;
     $fieldRacine = $this->field;
     $fieldBegin = $fieldRacine . "_beg";
     $fieldEnd = $fieldRacine . "_end";
     $data = "";
     // date départ
     $this->field = $fieldBegin;
     $this->value = $this->valuesPeriode[0];
     $this->defaultValue = $this->defaultValuesPeriode[0];
     $value = $this->getValue("");
     $this->controleRange = "onSelect: function( selectedDate ){\$('#scr_" . $fieldEnd . "').datepicker('option', 'minDate', selectedDate);},";
     $this->widthField = 0;
     parent::add();
     if (strpos($this->required, "beg") === 0) {
         $this->rule("required", true);
     }
     $smarty->assign('this', $this);
     $data .= $smarty->fetch($this->pathTemplate . 'inc/fields/class.date.tpl');
     // date fin
     $this->field = $fieldEnd;
     $this->value = $this->valuesPeriode[1];
     $this->defaultValue = $this->defaultValuesPeriode[1];
     $value = $this->getValue("");
     $this->controleRange = "onSelect: function( selectedDate ){\$('#scr_" . $fieldBegin . "').datepicker('option', 'maxDate', selectedDate);},";
     $this->widthField = 0;
     parent::add();
     if (strpos($this->required, "end")) {
         $this->rule("required", true);
     }
     $this->str_label = "<label class='label col'><i class='fa fa-caret-right'></i></label>";
     $smarty->assign('this', $this);
     $data .= $smarty->fetch($this->pathTemplate . 'inc/fields/class.date.tpl');
     $this->smartAssign($fieldRacine, $data);
     return $data;
 }
コード例 #27
0
ファイル: event.php プロジェクト: anqqa/Anqh
 /**
  * Get bind forum topics
  *
  * @param   string  $bind
  * @return  array
  */
 public function find_bind_topics($bind)
 {
     $topics = array();
     switch ($bind) {
         // Upcoming events
         case 'events_upcoming':
             $events = $this->find_upcoming(100);
             break;
             // Past events
         // Past events
         case 'events_past':
             $events = $this->find_past(100);
             break;
     }
     // Build human readable list
     if (!empty($events)) {
         foreach ($events as $event) {
             $topics[$event->id] = $event->name . ' ' . date::format('DDMMYYYY', $event->start_time);
         }
     }
     return $topics;
 }
コード例 #28
0
ファイル: Date.php プロジェクト: chernogolov/blank
 /**
  * Перевод вермени в человекопонятную форму
  * @param unix time string $time
  * @return string
  */
 public static function human_ru_time($time)
 {
     $month_name = date::ru_month(date('n', $time));
     // $month = $month_name[date('n', $time)];
     $month = $month_name;
     $day = date('j', $time);
     $year = date('Y', $time);
     $hour = date('G', $time);
     $min = date('i', $time);
     //        $date = $day . ' ' . $month . ' ' . $year . ' г. в ' . $hour . ':' . $min;
     $date = $day . ' ' . $month . ' ' . $year;
     $dif = time() - $time;
     if ($dif < 59) {
         return $dif . " сек. назад";
     } elseif ($dif / 60 > 1 and $dif / 60 < 59) {
         return round($dif / 60) . " мин. назад";
     } elseif ($dif / 3600 > 1 and $dif / 3600 < 23) {
         return round($dif / 3600) . " час. назад";
     } else {
         return $date;
     }
 }
コード例 #29
0
ファイル: model.php プロジェクト: leowh/colla
 /** 
  * Get order list.
  * 
  * @param  string  $mode 
  * @param  mix     $param 
  * @param  string  $orderBy 
  * @param  object  $pager 
  * @access public
  * @return array
  */
 public function getList($mode = 'all', $param = null, $owner = '', $orderBy = 'id_desc', $pager = null)
 {
     $customerIdList = $this->loadModel('customer')->getCustomersSawByMe();
     if (empty($customerIdList)) {
         return array();
     }
     $products = $this->loadModel('product')->getPairs();
     $this->app->loadClass('date', $static = true);
     $thisMonth = date::getThisMonth();
     $thisWeek = date::getThisWeek();
     /* Process search condition. */
     if ($this->session->orderQuery == false) {
         $this->session->set('orderQuery', ' 1 = 1');
     }
     $orderQuery = $this->loadModel('search', 'sys')->replaceDynamic($this->session->orderQuery);
     if (strpos($orderBy, 'status') !== false) {
         $orderBy .= ', closedReason';
     }
     if (strpos($orderBy, 'id') === false) {
         $orderBy .= ', id_desc';
     }
     $userList = $this->loadModel('user')->getSubUsers($this->app->user);
     $orders = $this->dao->select('o.*, c.name as customerName, c.level as level')->from(TABLE_ORDER)->alias('o')->leftJoin(TABLE_CUSTOMER)->alias('c')->on("o.customer=c.id")->where('o.deleted')->eq(0)->beginIF($userList != '')->andWhere()->markLeft(1)->where('o.assignedTo')->in($userList)->orWhere('o.createdBy')->in($userList)->orWhere('o.editedBy')->in($userList)->orWhere('o.signedBy')->in($userList)->markRight(1)->fi()->beginIF($mode == 'past')->andWhere('o.nextDate')->andWhere('o.nextDate')->lt(helper::today())->fi()->beginIF($mode == 'today')->andWhere('o.nextDate')->eq(helper::today())->fi()->beginIF($mode == 'tomorrow')->andWhere('o.nextDate')->eq(formattime(date::tomorrow(), DT_DATE1))->fi()->beginIF($mode == 'thisweek')->andWhere('o.nextDate')->between($thisWeek['begin'], $thisWeek['end'])->fi()->beginIF($mode == 'thismonth')->andWhere('o.nextDate')->between($thisMonth['begin'], $thisMonth['end'])->fi()->beginIF($mode == 'public')->andWhere('public')->eq('1')->fi()->beginIF($mode == 'assignedTo')->andWhere('o.assignedTo')->eq($this->app->user->account)->fi()->beginIF($mode == 'createdBy')->andWhere('o.createdBy')->eq($this->app->user->account)->fi()->beginIF($mode == 'signedBy')->andWhere('o.signedBy')->eq($this->app->user->account)->fi()->beginIF($mode == 'query')->andWhere($param)->fi()->beginIF($mode == 'bysearch')->andWhere($orderQuery)->fi()->andWhere('o.customer')->in($customerIdList)->orderBy($orderBy)->page($pager)->fetchAll('id');
     foreach ($orders as $order) {
         $order->products = array();
         $productList = explode(',', $order->product);
         foreach ($productList as $product) {
             if (isset($products[$product])) {
                 $order->products[] = $products[$product];
             }
         }
     }
     foreach ($orders as $order) {
         $productName = count($order->products) > 1 ? current($order->products) . $this->lang->etc : current($order->products);
         $order->title = sprintf($this->lang->order->titleLBL, $order->customerName, $productName, date('Y-m-d', strtotime($order->createdDate)));
     }
     return $orders;
 }
コード例 #30
0
ファイル: model.php プロジェクト: Wen1750686723/zentaopms
 /**
  * Compute the begin date and end date of a period.
  * 
  * @param  string    $period   all|today|yesterday|twodaysago|latest2days|thisweek|lastweek|thismonth|lastmonth
  * @access public
  * @return array
  */
 public function computeBeginAndEnd($period)
 {
     $this->app->loadClass('date');
     $today = date::today();
     $tomorrow = date::tomorrow();
     $yesterday = date::yesterday();
     $twoDaysAgo = date::twoDaysAgo();
     $period = strtolower($period);
     if ($period == 'all') {
         return array('begin' => '1970-1-1', 'end' => '2109-1-1');
     }
     if ($period == 'today') {
         return array('begin' => $today, 'end' => $tomorrow);
     }
     if ($period == 'yesterday') {
         return array('begin' => $yesterday, 'end' => $today);
     }
     if ($period == 'twodaysago') {
         return array('begin' => $twoDaysAgo, 'end' => $yesterday);
     }
     if ($period == 'latest3days') {
         return array('begin' => $twoDaysAgo, 'end' => $tomorrow);
     }
     /* If the period is by week, add the end time to the end date. */
     if ($period == 'thisweek' or $period == 'lastweek') {
         $func = "get{$period}";
         extract(date::$func());
         return array('begin' => $begin, 'end' => $end . ' 23:59:59');
     }
     if ($period == 'thismonth') {
         return date::getThisMonth();
     }
     if ($period == 'lastmonth') {
         return date::getLastMonth();
     }
 }