当前位置: 首页>>代码示例>>PHP>>正文


PHP SugarDateTime::setTime方法代码示例

本文整理汇总了PHP中SugarDateTime::setTime方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarDateTime::setTime方法的具体用法?PHP SugarDateTime::setTime怎么用?PHP SugarDateTime::setTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SugarDateTime的用法示例。


在下文中一共展示了SugarDateTime::setTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: queryMonth

 /**
  * Create query from the beginning to the end of certain month
  * @param array $layout_def
  * @param SugarDateTime $month
  */
 protected function queryMonth($layout_def, $month)
 {
     $begin = $month->setTime(0, 0, 0);
     $end = clone $begin;
     $end->setDate($begin->year, $begin->month, $begin->days_in_month)->setTime(23, 59, 59);
     return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb());
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:12,代码来源:SugarWidgetFielddatetime.php

示例2: createSugarIcalTodo

 /**
  * Create a todo entry for the given task.
  *
  * @param UserBean $user_bean the current UserBean
  * @param Task $task the task for the todo entry
  * @param string $moduleName the name of the task module
  * @param string $dtstamp the current timestamp
  * @return string the todo entry for the task
  */
 protected function createSugarIcalTodo($user_bean, $task, $moduleName, $dtstamp)
 {
     global $sugar_config;
     $ical_array = array();
     $ical_array[] = array("BEGIN", "VTODO");
     $validDueDate = isset($task->date_due) && $task->date_due != "" && $task->date_due != "0000-00-00";
     $validDueTime = isset($task->time_due) && $task->time_due != "";
     $dueYear = 1970;
     $dueMonth = 1;
     $dueDay = 1;
     $dueHour = 0;
     $dueMin = 0;
     if ($validDueDate) {
         $dateDueArr = explode("-", $task->date_due);
         $dueYear = (int) $dateDueArr[0];
         $dueMonth = (int) $dateDueArr[1];
         $dueDay = (int) $dateDueArr[2];
         if ($validDueTime) {
             $timeDueArr = explode(":", $task->time_due);
             $dueHour = (int) $timeDueArr[0];
             $dueMin = (int) $timeDueArr[1];
         }
     }
     $date_arr = array('day' => $dueDay, 'month' => $dueMonth, 'hour' => $dueHour, 'min' => $dueMin, 'year' => $dueYear);
     $due_date_time = new SugarDateTime();
     $due_date_time->setDate($dueYear, $dueMonth, $dueDay);
     $due_date_time->setTime($dueHour, $dueMin);
     $ical_array[] = array("DTSTART;TZID=" . $user_bean->getPreference('timezone'), str_replace("Z", "", $this->getUtcDateTime($due_date_time)));
     $ical_array[] = array("DTSTAMP", $dtstamp);
     $ical_array[] = array("SUMMARY", $task->name);
     $ical_array[] = array("UID", $task->id);
     if ($validDueDate) {
         $iCalDueDate = str_replace("-", "", $task->date_due);
         if (strlen($iCalDueDate) > 8) {
             $iCalDueDate = substr($iCalDueDate, 0, 8);
         }
         $ical_array[] = array("DUE;VALUE=DATE", $iCalDueDate);
     }
     if ($moduleName == "ProjectTask") {
         $ical_array[] = array("DESCRIPTION:Project", $task->project_name . vCal::EOL . vCal::EOL . $task->description);
     } else {
         $ical_array[] = array("DESCRIPTION", $task->description);
     }
     $ical_array[] = array("URL;VALUE=URI", $sugar_config['site_url'] . "/index.php?module=" . $moduleName . "&action=DetailView&record=" . $task->id);
     if ($task->status == 'Completed') {
         $ical_array[] = array("STATUS", "COMPLETED");
         $ical_array[] = array("PERCENT-COMPLETE", "100");
         $ical_array[] = array("COMPLETED", $this->getUtcDateTime($due_date_time));
     } else {
         if (!empty($task->percent_complete)) {
             $ical_array[] = array("PERCENT-COMPLETE", $task->percent_complete);
         }
     }
     if ($task->priority == "Low") {
         $ical_array[] = array("PRIORITY", "9");
     } else {
         if ($task->priority == "Medium") {
             $ical_array[] = array("PRIORITY", "5");
         } else {
             if ($task->priority == "High") {
                 $ical_array[] = array("PRIORITY", "1");
             }
         }
     }
     $ical_array[] = array("END", "VTODO");
     return vCal::create_ical_string_from_array($ical_array, true);
 }
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:76,代码来源:iCal.php

示例3: createSugarIcalTodo

 /**
  * Create a todo entry for the given task.
  *
  * @param UserBean $user_bean the current UserBean
  * @param Task $task the task for the todo entry
  * @param string $moduleName the name of the task module
  * @param string $dtstamp the current timestamp
  * @return string the todo entry for the task
  */
 protected function createSugarIcalTodo($user_bean, $task, $moduleName, $dtstamp)
 {
     global $sugar_config;
     $str = "";
     $str .= "BEGIN:VTODO\n";
     $validDueDate = isset($task->date_due) && $task->date_due != "" && $task->date_due != "0000-00-00";
     $validDueTime = isset($task->time_due) && $task->time_due != "";
     $dueYear = 1970;
     $dueMonth = 1;
     $dueDay = 1;
     $dueHour = 0;
     $dueMin = 0;
     if ($validDueDate) {
         $dateDueArr = split("-", $task->date_due);
         $dueYear = (int) $dateDueArr[0];
         $dueMonth = (int) $dateDueArr[1];
         $dueDay = (int) $dateDueArr[2];
         if ($validDueTime) {
             $timeDueArr = split(":", $task->time_due);
             $dueHour = (int) $timeDueArr[0];
             $dueMin = (int) $timeDueArr[1];
         }
     }
     $date_arr = array('day' => $dueDay, 'month' => $dueMonth, 'hour' => $dueHour, 'min' => $dueMin, 'year' => $dueYear);
     $due_date_time = new SugarDateTime();
     $due_date_time->setDate($dueYear, $dueMonth, $dueDay);
     $due_date_time->setTime($dueHour, $dueMin);
     $str .= "DTSTART;TZID=" . $user_bean->getPreference('timezone') . ":" . str_replace("Z", "", $this->getUtcDateTime($due_date_time)) . "\n";
     $str .= "DTSTAMP:" . $dtstamp . "\n";
     $str .= "SUMMARY:" . $task->name . "\n";
     $str .= "UID:" . $task->id . "\n";
     if ($validDueDate) {
         $iCalDueDate = str_replace("-", "", $task->date_due);
         if (strlen($iCalDueDate) > 8) {
             $iCalDueDate = substr($iCalDueDate, 0, 8);
         }
         $str .= "DUE;VALUE=DATE:" . $iCalDueDate . "\n";
     }
     if ($moduleName == "ProjectTask") {
         $str .= "DESCRIPTION:Project: " . $task->project_name . "\\n\\n" . $this->escapeNls($task->description) . "\n";
     } else {
         $str .= "DESCRIPTION:" . $this->escapeNls($task->description) . "\n";
     }
     $str .= "URL;VALUE=URI:" . $sugar_config['site_url'] . "/index.php?module=" . $moduleName . "&action=DetailView&record=" . $task->id . "\n";
     if ($task->status == 'Completed') {
         $str .= "STATUS:COMPLETED\n";
         $str .= "PERCENT-COMPLETE:100\n";
         $str .= "COMPLETED:" . $this->getUtcDateTime($due_date_time) . "\n";
     } else {
         if (!empty($task->percent_complete)) {
             $str .= "PERCENT-COMPLETE:" . $task->percent_complete . "\n";
         }
     }
     if ($task->priority == "Low") {
         $str .= "PRIORITY:9\n";
     } else {
         if ($task->priority == "Medium") {
             $str .= "PRIORITY:5\n";
         } else {
             if ($task->priority == "High") {
                 $str .= "PRIORITY:1\n";
             }
         }
     }
     $str .= "END:VTODO\n";
     return $str;
 }
开发者ID:sunmo,项目名称:snowlotus,代码行数:76,代码来源:iCal.php


注:本文中的SugarDateTime::setTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。