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


PHP TimeDate::to_display_date方法代码示例

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


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

示例1: setup

 public function setup()
 {
     global $current_user;
     $current_user = SugarTestUserUtilities::createAnonymousUser();
     //for the purpose of this test, we need to create a campaign and relate it to a campaign tracker object
     //create campaign
     $c = new Campaign();
     $c->name = 'CT test ' . time();
     $c->campaign_type = 'Email';
     $c->status = 'Active';
     $timeDate = new TimeDate();
     $c->end_date = $timeDate->to_display_date(date('Y') + 1 . '-01-01');
     $c->assigned_id = $current_user->id;
     $c->team_id = '1';
     $c->team_set_id = '1';
     $c->save();
     $this->campaign = $c;
     //create campaign tracker
     $ct = new CampaignTracker();
     $ct->tracker_name = 'CampaignTrackerTest' . time();
     $ct->tracker_url = 'sugarcrm.com';
     $ct->campaign_id = $this->campaign->id;
     $ct->save();
     $this->campaign_tracker = $ct;
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:25,代码来源:CampaignTrackersTest.php

示例2: TimeDate

 /**
  * This function retrieves a record of the appropriate type from the DB.
  * It fills in all of the fields from the DB into the object it was called on.
  *
  * @param $id - If ID is specified, it overrides the current value of $this->id.  If not specified the current value of $this->id will be used.
  * @return this - The object that it was called apon or null if exactly 1 record was not found.
  *
  */
 function check_date_relationships_load()
 {
     global $disable_date_format;
     if (!empty($disable_date_format)) {
         return;
     }
     global $timedate;
     if (empty($timedate)) {
         $timedate = new TimeDate();
     }
     if (empty($this->field_defs)) {
         return;
     }
     foreach ($this->field_defs as $fieldDef) {
         $field = $fieldDef['name'];
         if (!isset($this->processed_dates_times[$field])) {
             $this->processed_dates_times[$field] = '1';
             if ($field == 'date_modified' || $field == 'date_entered') {
                 if (!empty($this->{$field})) {
                     $this->{$field} = $timedate->to_display_date_time($this->{$field});
                 }
             } elseif (!empty($this->{$field}) && isset($this->field_name_map[$field]['type'])) {
                 $type = $this->field_name_map[$field]['type'];
                 if ($type == 'relate' && isset($this->field_name_map[$field]['custom_module'])) {
                     $type = $this->field_name_map[$field]['type'];
                 }
                 if ($type == 'date') {
                     $this->{$field} = from_db_convert($this->{$field}, 'date');
                     if ($this->{$field} == '0000-00-00') {
                         $this->{$field} = '';
                     } elseif (!empty($this->field_name_map[$field]['rel_field'])) {
                         $rel_field = $this->field_name_map[$field]['rel_field'];
                         if (!empty($this->{$rel_field})) {
                             $this->{$rel_field} = from_db_convert($this->{$rel_field}, 'time');
                             $mergetime = $timedate->merge_date_time($this->{$field}, $this->{$rel_field});
                             $this->{$field} = $timedate->to_display_date($mergetime);
                             $this->{$rel_field} = $timedate->to_display_time($mergetime);
                         }
                     } else {
                         $this->{$field} = $timedate->to_display_date($this->{$field}, false);
                     }
                 } elseif ($type == 'datetime') {
                     if ($this->{$field} == '0000-00-00 00:00:00') {
                         $this->{$field} = '';
                     } else {
                         $this->{$field} = $timedate->to_display_date_time($this->{$field});
                     }
                 } elseif ($type == 'time') {
                     if ($this->{$field} == '00:00:00') {
                         $this->{$field} = '';
                     } else {
                         //$this->$field = from_db_convert($this->$field, 'time');
                         if (empty($this->field_name_map[$field]['rel_field'])) {
                             $this->{$field} = $timedate->to_display_time($this->{$field}, true, false);
                         }
                     }
                 } elseif ($type == 'encrypt') {
                     $this->{$field} = $this->decrypt_after_retrieve($this->{$field});
                 }
             }
         }
     }
 }
开发者ID:Terradex,项目名称:sugar,代码行数:71,代码来源:SugarBean.php

示例3: setUp

 public function setUp()
 {
     $this->markTestIncomplete('Marking this skipped until we figure out why it is causing the SQL server connection to go away.');
     $this->clear_database = true;
     $this->remove_beans = true;
     $this->saved_current_user = $GLOBALS['current_user'];
     $user = new User();
     $user->retrieve('1');
     $GLOBALS['current_user'] = $user;
     $this->campaign = new Campaign();
     $this->campaign->name = 'Bug39665Test ' . time();
     $this->campaign->campaign_type = 'Email';
     $this->campaign->status = 'Active';
     $timeDate = new TimeDate();
     $this->campaign->end_date = $timeDate->to_display_date(date('Y') + 1 . '-01-01');
     $this->campaign->assigned_id = $user->id;
     $this->campaign->team_id = '1';
     $this->campaign->team_set_id = '1';
     $this->campaign->save();
     $this->emailmarketing = new EmailMarketing();
     $this->emailmarketing->name = $this->campaign->name . ' Email1';
     $this->emailmarketing->campaign_id = $this->campaign->id;
     $this->emailmarketing->from_name = 'SugarCRM';
     $this->emailmarketing->from_addr = 'from@exmaple.com';
     $this->emailmarketing->reply_to_name = 'SugarCRM';
     $this->emailmarketing->reply_to_addr = 'reply@exmaple.com';
     $this->emailmarketing->status = 'active';
     $this->emailmarketing->all_prospect_lists = 1;
     $this->emailmarketing->date_start = $timeDate->to_display_date(date('Y') + 1 . '-01-01') . ' 00:00:00';
     $this->emailmarketing2 = new EmailMarketing();
     $this->emailmarketing2->name = $this->campaign->name . ' Email2';
     $this->emailmarketing2->campaign_id = $this->campaign->id;
     $this->emailmarketing2->from_name = 'SugarCRM';
     $this->emailmarketing2->from_addr = 'do_not_reply@exmaple.com';
     $this->emailmarketing2->reply_to_name = 'SugarCRM';
     $this->emailmarketing2->reply_to_addr = 'reply@exmaple.com';
     $this->emailmarketing2->status = 'active';
     $this->emailmarketing2->all_prospect_lists = 1;
     $this->emailmarketing2->date_start = $timeDate->to_display_date(date('Y') + 1 . '-01-01') . ' 00:00:00';
     $query = 'SELECT id FROM inbound_email WHERE deleted=0';
     $result = $GLOBALS['db']->query($query);
     while ($row = $GLOBALS['db']->fetchByAssoc($result)) {
         $this->emailmarketing->inbound_email_id = $row['id'];
         $this->emailmarketing2->inbound_email_id = $row['id'];
         break;
     }
     $query = 'SELECT id FROM email_templates WHERE deleted=0';
     while ($row = $GLOBALS['db']->fetchByAssoc($result)) {
         $this->emailmarketing->template_id = $row['id'];
         $this->emailmarketing2->template_id = $row['id'];
         break;
     }
     $this->emailmarketing->save();
     $this->emailmarketing2->save();
     $this->campaign->load_relationship('prospectlists');
     $this->prospectlist = new ProspectList();
     $this->prospectlist->name = $this->campaign->name . ' Prospect List1';
     $this->prospectlist->assigned_user_id = $GLOBALS['current_user']->id;
     $this->prospectlist->list_type = "default";
     $this->prospectlist->save();
     $this->campaign->prospectlists->add($this->prospectlist->id);
     $this->campaign->load_relationship('prospectlists');
     $this->prospectlist2 = new ProspectList();
     $this->prospectlist2->name = $this->campaign->name . ' Prospect List2';
     $this->prospectlist2->assigned_user_id = $GLOBALS['current_user']->id;
     $this->prospectlist2->list_type = "default";
     $this->prospectlist2->save();
     $this->campaign->prospectlists->add($this->prospectlist2->id);
     $campaign_log_states = array(0 => 'viewed', 1 => 'link', 2 => 'invalid email', 3 => 'send error', 4 => 'removed', 5 => 'blocked', 6 => 'lead', 7 => 'contact');
     for ($i = 0; $i < 10; $i++) {
         $contact = SugarTestContactUtilities::createContact();
         $contact->campaign_id = $this->campaign->id;
         $contact->email2 = 'contact' . mt_rand() . '@sugar.com';
         //Simulate a secondary email
         $contact->save();
         $contact->load_relationship('prospect_lists');
         $contact->prospect_lists->add($this->prospectlist->id);
         $contact->prospect_lists->add($this->prospectlist2->id);
         $this->create_campaign_log($this->campaign, $contact, $this->emailmarketing, $this->prospectlist, 'targeted');
         $this->create_campaign_log($this->campaign, $contact, $this->emailmarketing, $this->prospectlist, $campaign_log_states[mt_rand(0, 7)]);
         $this->create_campaign_log($this->campaign, $contact, $this->emailmarketing2, $this->prospectlist, 'targeted');
         $this->create_campaign_log($this->campaign, $contact, $this->emailmarketing2, $this->prospectlist, $campaign_log_states[mt_rand(0, 7)]);
     }
     for ($i = 0; $i < 10; $i++) {
         $lead = SugarTestLeadUtilities::createLead();
         $lead->campaign_id = $this->campaign->id;
         $lead->email2 = 'lead2' . mt_rand() . '@sugar.com';
         //Simulate a secondary email
         $lead->save();
         $lead->load_relationship('prospect_lists');
         $lead->prospect_lists->add($this->prospectlist->id);
         $lead->prospect_lists->add($this->prospectlist2->id);
         $this->create_campaign_log($this->campaign, $lead, $this->emailmarketing, $this->prospectlist, 'targeted');
         $this->create_campaign_log($this->campaign, $lead, $this->emailmarketing, $this->prospectlist, $campaign_log_states[mt_rand(0, 7)]);
         $this->create_campaign_log($this->campaign, $lead, $this->emailmarketing2, $this->prospectlist, 'targeted');
         $this->create_campaign_log($this->campaign, $lead, $this->emailmarketing2, $this->prospectlist, $campaign_log_states[mt_rand(0, 7)]);
     }
     //But wait, there's more... now we email the friggin thing to place it in the queue
     if ($this->campaign->db->dbType == 'oci8') {
     } else {
//.........这里部分代码省略.........
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:101,代码来源:Bug40233Test.php

示例4: TimeDate

 function action_get_end_date()
 {
     global $db, $timeDate;
     $timeDate = new TimeDate();
     $id = $_POST['task_id'];
     $lag = $_POST['lag'];
     //Get the end date of the projectTask in raw database format
     $query = "SELECT date_finish FROM project_task WHERE id = '{$id}'";
     $end_date = $db->getOne($query);
     //Add 1 day onto end date for first day of new task
     $start_date = date('Y-m-d', strtotime($end_date . ' + 1 days'));
     //Add lag onto start date
     $start_date = date('Y-m-d', strtotime($start_date . ' + ' . $lag . ' days'));
     echo $timeDate->to_display_date($start_date, true);
     die;
 }
开发者ID:samus-aran,项目名称:SuiteCRM,代码行数:16,代码来源:controller.php

示例5: draw

 public function draw($tasks)
 {
     global $mod_strings, $app_list_strings;
     // Instantiate the TimeDate Class
     $timeDate = new TimeDate();
     echo '<table id="Task_table" class="project_table_header">
             <tr class="disable_sort">
                 <td style="min-width:32px;" class="project_table_headings">' . $mod_strings['LBL_TASK_ID'] . '</td>
                 <td style="min-width:85px;" class="project_table_headings">' . $mod_strings['LBL_TASK_NAME'] . '</td>
                 <td style="min-width:100px;" class="project_table_headings">' . $mod_strings['LBL_PREDECESSORS'] . '</td>
                 <td style="min-width:100px;" class="project_table_headings">' . $mod_strings['LBL_START'] . '</td>
                 <td style="min-width:100px;" class="project_table_headings">' . $mod_strings['LBL_FINISH'] . '</td>
                 <td style="min-width:100px;" class="project_table_headings">' . $mod_strings['LBL_DURATION'] . '</td>
                 <td style="min-width:120px;" class="project_table_headings">' . $mod_strings['LBL_ASSIGNED_USER_ID'] . '</td>
                 <td style="min-width:48px;" class="project_table_headings">' . $mod_strings['LBL_PERCENT_COMPLETE'] . '</td>
                 <td style="min-width:80px;" class="project_table_headings">' . $mod_strings['LBL_MILESTONE_FLAG'] . '</td>
                 <td style="min-width:80px;" class="project_table_headings">' . $mod_strings['LBL_ACTUAL_DURATION'] . '</td>
                 <td style="min-width:30px;" class="project_table_headings"></td>
             </tr>
     ';
     $task_count = 0;
     if (!is_null($tasks)) {
         foreach ($tasks as $task) {
             //Get resources
             $project = new Project();
             $project->retrieve($task->project_id);
             //Get project resources (users & contacts)
             $resources1 = $project->get_linked_beans('project_users_1', 'User');
             $resources2 = $project->get_linked_beans('project_contacts_1', 'Contact');
             //Combine resources into array of objects
             $resource_array = array();
             foreach ($resources1 as $user) {
                 $resource = new stdClass();
                 $resource->id = $user->id;
                 $resource->name = $user->name;
                 $resource->type = 'user';
                 $resource_array[] = $resource;
             }
             foreach ($resources2 as $contact) {
                 $resource = new stdClass();
                 $resource->id = $contact->id;
                 $resource->name = $contact->name;
                 $resource->type = 'contact';
                 $resource_array[] = $resource;
             }
             echo '<tr class="row_sortable">
                     <td class="project_table_cells"><input class="order_number" name="order_number[]" rel="' . $task->id . '" type="hidden" value="' . $task->order_number . '" />' . $task->project_task_id . '</td>';
             if (ACLController::checkAccess('Project', 'edit', true)) {
                 echo '<td class="project_table_cells" ><span class="Task_name" ><a data = "' . $task->id . ',' . $task->predecessors . ',' . $task->relationship_type . ',' . $timeDate->to_display_date($task->date_start, true) . ',' . $task->duration . ',' . $task->duration_unit . ',' . $task->assigned_user_id . ',' . $task->milestone_flag . ',' . $task->percent_complete . ',' . $task->description . ',' . $task->actual_duration . '" onclick = "edit_task($(this));"title = "' . $mod_strings['LBL_TASK_TITLE'] . '" href = "#" > ' . $task->name . '</a ></span ></td>';
             } else {
                 echo '<td class="project_table_cells" ><span class="Task_name" >' . $task->name . '</span ></td>';
             }
             echo '<td class="project_table_cells">';
             foreach ($tasks as $predecessor) {
                 if ($predecessor->project_task_id == $task->predecessors) {
                     echo $predecessor->name;
                 }
             }
             echo '
                     </td>
                     <td class="project_table_cells">' . $timeDate->to_display_date($task->date_start, true) . '</td>
                     <td class="project_table_cells">' . $timeDate->to_display_date($task->date_finish, true) . '</td>
                     <td class="project_table_cells">' . $task->duration . ' ' . $app_list_strings['duration_unit_dom'][$task->duration_unit] . '</td>
                     <td style="min-width:105px;" class="project_table_cells" >';
             $rflag = '0';
             foreach ($resource_array as $resource) {
                 if ($resource->id == $task->assigned_user_id) {
                     if ($resource->type == 'user') {
                         echo '<a target="blank" href="index.php?module=Users&action=DetailView&record=' . $resource->id . '">' . $resource->name . '</a>';
                         $rflag = '1';
                     } elseif ($resource->type == 'contact') {
                         echo '<a target="blank" href="index.php?module=Contacts&action=DetailView&record=' . $resource->id . '">' . $resource->name . '</a>';
                         $rflag = '1';
                     }
                 }
             }
             if ($rflag == '0') {
                 echo $mod_strings['LBL_UNASSIGNED'];
             }
             if ($task->milestone_flag == '1') {
                 $checked = $app_list_strings['checkbox_dom']['1'];
             } else {
                 $checked = $app_list_strings['checkbox_dom']['2'];
             }
             echo '</td>
                     <td class="project_table_cells">' . $task->percent_complete . '</td>
                     <td class="project_table_cells">' . $checked . '</td>
                     <td class="project_table_cells">' . $task->actual_duration . '</td>
                     <td class="project_table_cells">
                         <span id="exportToPDFSpan">';
             if (ACLController::checkAccess('Project', 'delete', true)) {
                 echo '<button style = "height:20px;width:20px;" class="remove_button" value = "' . $task->id . '" class="gantt_button" > Delete Task </button >';
             } else {
                 echo '<button disabled="disabled" style = "height:20px;width:20px;" class="remove_button" value = "' . $task->id . '" class="gantt_button" > Delete Task </button >';
             }
             echo '</span>
                      </td>
                 </tr>';
             $task_count++;
         }
//.........这里部分代码省略.........
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:101,代码来源:project_table.php

示例6: testToDisplayDateFormatsWithTz

 /**
  * test conversion from DB date to local date with TZ handling
  * @dataProvider dateTestSet
  */
 public function testToDisplayDateFormatsWithTz($db, $df, $tf, $tz, $display, $dbdate)
 {
     $this->_setPrefs($df, $tf, $tz);
     $result = $this->time_date->to_display_date($db, true);
     $this->assertEquals($this->_dateOnly($display), $this->_dateOnly($result), "Broken conversion for '{$df}' with date '{$dbdate}' and TZ {$tz}");
 }
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:10,代码来源:TimeDateTest.php


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