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


PHP ilFormat::formatUnixTime方法代码示例

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


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

示例1: exportReleased

 /**
  * export released
  *
  * @access protected
  * @return
  */
 protected function exportReleased()
 {
     global $ilObjDataCache;
     include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
     $exported = ilECSExport::getExportedIds();
     $ilObjDataCache->preloadObjectCache($exported);
     include_once 'Services/Utilities/classes/class.ilCSVWriter.php';
     $writer = new ilCSVWriter();
     $writer->addColumn($this->lng->txt('title'));
     $writer->addColumn($this->lng->txt('description'));
     $writer->addColumn($this->lng->txt('ecs_field_courseID'));
     $writer->addColumn($this->lng->txt('ecs_field_term'));
     $writer->addColumn($this->lng->txt('ecs_field_lecturer'));
     $writer->addColumn($this->lng->txt('ecs_field_courseType'));
     $writer->addColumn($this->lng->txt('ecs_field_semester_hours'));
     $writer->addColumn($this->lng->txt('ecs_field_credits'));
     $writer->addColumn($this->lng->txt('ecs_field_room'));
     $writer->addColumn($this->lng->txt('ecs_field_cycle'));
     $writer->addColumn($this->lng->txt('ecs_field_begin'));
     $writer->addColumn($this->lng->txt('ecs_field_end'));
     $writer->addColumn($this->lng->txt('last_update'));
     include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php';
     $settings = ilECSDataMappingSettings::_getInstance();
     foreach ($exported as $obj_id) {
         include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php';
         $values = ilAdvancedMDValues::_getValuesByObjId($obj_id);
         $writer->addRow();
         $writer->addColumn(ilObject::_lookupTitle($obj_id));
         $writer->addColumn(ilObject::_lookupDescription($obj_id));
         $field = $settings->getMappingByECSName('courseID');
         $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
         $field = $settings->getMappingByECSName('term');
         $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
         $field = $settings->getMappingByECSName('lecturer');
         $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
         $field = $settings->getMappingByECSName('courseType');
         $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
         $field = $settings->getMappingByECSName('semester_hours');
         $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
         $field = $settings->getMappingByECSName('credits');
         $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
         $field = $settings->getMappingByECSName('room');
         $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
         $field = $settings->getMappingByECSName('cycle');
         $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
         $field = $settings->getMappingByECSName('begin');
         $writer->addColumn(isset($values[$field]) ? ilFormat::formatUnixTime($values[$field], true) : '');
         $field = $settings->getMappingByECSName('end');
         $writer->addColumn(isset($values[$field]) ? ilFormat::formatUnixTime($values[$field], true) : '');
         $writer->addColumn($ilObjDataCache->lookupLastUpdate($obj_id));
     }
     ilUtil::deliverData($writer->getCSVString(), date("Y_m_d") . "_ecs_export.csv", "text/csv");
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:59,代码来源:class.ilECSSettingsGUI.php

示例2: getHTML

 /**
  * render attendance list
  *
  * @return string
  */
 public function getHTML()
 {
     $tpl = new ilTemplate('tpl.attendance_list_print.html', true, true, 'Services/Membership');
     // title
     $time = ilFormat::formatUnixTime(time(), true);
     $tpl->setVariable('TXT_TITLE', $this->title);
     if ($this->description) {
         $tpl->setVariable('TXT_DESCRIPTION', $this->description . " (" . $time . ")");
     } else {
         $tpl->setVariable('TXT_DESCRIPTION', $time);
     }
     // header
     $tpl->setCurrentBlock('head_item');
     foreach ($this->presets as $id => $item) {
         if ($item[1]) {
             $tpl->setVariable('TXT_HEAD', $item[0]);
             $tpl->parseCurrentBlock();
         }
     }
     if ($this->blank_columns) {
         foreach ($this->blank_columns as $blank) {
             $tpl->setVariable('TXT_HEAD', $blank);
             $tpl->parseCurrentBlock();
         }
     }
     // handle members
     $member_ids = array();
     if ($this->show_admins) {
         $member_ids = array_merge((array) $member_ids, $this->participants->getAdmins());
     }
     if ($this->show_tutors) {
         $member_ids = array_merge((array) $member_ids, $this->participants->getTutors());
     }
     if ($this->show_members) {
         $member_ids = array_merge((array) $member_ids, $this->participants->getMembers());
     }
     $member_ids = ilUtil::_sortIds((array) $member_ids, 'usr_data', 'lastname', 'usr_id');
     // rows
     foreach ($member_ids as $user_id) {
         if ($this->callback) {
             $user_data = call_user_func_array($this->callback, array($user_id));
             $tpl->setCurrentBlock("row_preset");
             foreach ($this->presets as $id => $item) {
                 if ($item[1]) {
                     switch ($id) {
                         case "name":
                             if (!$user_data[$id]) {
                                 $name = ilObjUser::_lookupName($user_id);
                                 $value = $name["lastname"] . ", " . $name["firstname"];
                                 break;
                             }
                         case "email":
                             if (!$user_data[$id]) {
                                 $value = ilObjUser::_lookupEmail($user_id);
                                 break;
                             }
                         case "login":
                             if (!$user_data[$id]) {
                                 $value = ilObjUser::_lookupLogin($user_id);
                                 break;
                             }
                         default:
                             $value = (string) $user_data[$id];
                             break;
                     }
                     $tpl->setVariable("TXT_PRESET", $value);
                     $tpl->parseCurrentBlock();
                 }
             }
         }
         if ($this->blank_columns) {
             for ($loop = 0; $loop < sizeof($this->blank_columns); $loop++) {
                 $tpl->touchBlock('row_blank');
             }
         }
         $tpl->touchBlock("member_row");
     }
     return $tpl->get();
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:84,代码来源:class.ilAttendanceList.php

示例3: write

 /**
  * Write data
  * @return 
  */
 protected function write()
 {
     // Add header line
     $row = 0;
     $col = 0;
     foreach ($all_fields = $this->getOrderedExportableFields() as $field) {
         switch ($field) {
             case 'role':
                 #$this->csv->addColumn($this->lng->txt($this->getType().'_role_status'));
                 $this->addCol($this->lng->txt($this->getType() . '_role_status'), $row, $col++);
                 break;
             case 'agreement':
                 #$this->csv->addColumn($this->lng->txt('ps_agreement_accepted'));
                 $this->addCol($this->lng->txt('ps_agreement_accepted'), $row, $col++);
                 break;
             case 'consultation_hour':
                 $this->lng->loadLanguageModule('dateplaner');
                 $this->addCol($this->lng->txt('cal_ch_field_ch'), $row, $col++);
                 break;
             default:
                 if (substr($field, 0, 4) == 'udf_') {
                     $field_id = explode('_', $field);
                     include_once 'Services/User/classes/class.ilUserDefinedFields.php';
                     $udf = ilUserDefinedFields::_getInstance();
                     $def = $udf->getDefinition($field_id[1]);
                     #$this->csv->addColumn($def['field_name']);
                     $this->addCol($def['field_name'], $row, $col++);
                 } elseif (substr($field, 0, 4) == 'cdf_') {
                     $field_id = explode('_', $field);
                     #$this->csv->addColumn(ilCourseDefinedFieldDefinition::_lookupName($field_id[1]));
                     $this->addCol(ilCourseDefinedFieldDefinition::_lookupName($field_id[1]), $row, $col++);
                 } else {
                     #$this->csv->addColumn($this->lng->txt($field));
                     $this->addCol($this->lng->txt($field), $row, $col++);
                 }
                 break;
         }
     }
     #$this->csv->addRow();
     $this->addRow();
     // Add user data
     foreach ($this->user_ids as $usr_id) {
         $row++;
         $col = 0;
         $udf_data = new ilUserDefinedData($usr_id);
         foreach ($all_fields as $field) {
             // Handle course defined fields
             if ($this->addUserDefinedField($udf_data, $field, $row, $col)) {
                 $col++;
                 continue;
             }
             if ($this->addCourseField($usr_id, $field, $row, $col)) {
                 $col++;
                 continue;
             }
             switch ($field) {
                 case 'role':
                     switch ($this->user_course_data[$usr_id]['role']) {
                         case IL_CRS_ADMIN:
                             #$this->csv->addColumn($this->lng->txt('crs_admin'));
                             $this->addCol($this->lng->txt('crs_admin'), $row, $col++);
                             break;
                         case IL_CRS_TUTOR:
                             #$this->csv->addColumn($this->lng->txt('crs_tutor'));
                             $this->addCol($this->lng->txt('crs_tutor'), $row, $col++);
                             break;
                         case IL_CRS_MEMBER:
                             #$this->csv->addColumn($this->lng->txt('crs_member'));
                             $this->addCol($this->lng->txt('crs_member'), $row, $col++);
                             break;
                         case IL_GRP_ADMIN:
                             #$this->csv->addColumn($this->lng->txt('il_grp_admin'));
                             $this->addCol($this->lng->txt('il_grp_admin'), $row, $col++);
                             break;
                         case IL_GRP_MEMBER:
                             #$this->csv->addColumn($this->lng->txt('il_grp_member'));
                             $this->addCol($this->lng->txt('il_grp_member'), $row, $col++);
                             break;
                         case 'subscriber':
                             #$this->csv->addColumn($this->lng->txt($this->getType().'_subscriber'));
                             $this->addCol($this->lng->txt($this->getType() . '_subscriber'), $row, $col++);
                             break;
                         default:
                             #$this->csv->addColumn($this->lng->txt('crs_waiting_list'));
                             $this->addCol($this->lng->txt('crs_waiting_list'), $row, $col++);
                             break;
                     }
                     break;
                 case 'agreement':
                     if (isset($this->agreement[$usr_id])) {
                         if ($this->agreement[$usr_id]['accepted']) {
                             #$this->csv->addColumn(ilFormat::formatUnixTime($this->agreement[$usr_id]['acceptance_time'],true));
                             $this->addCol(ilFormat::formatUnixTime($this->agreement[$usr_id]['acceptance_time'], true), $row, $col++);
                         } else {
                             #$this->csv->addColumn($this->lng->txt('ps_not_accepted'));
                             $this->addCol($this->lng->txt('ps_not_accepted'), $row, $col++);
//.........这里部分代码省略.........
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:101,代码来源:class.ilMemberExport.php

示例4: write

 /**
  * Write data
  * @return 
  */
 protected function write()
 {
     // Add header line
     $row = 0;
     $col = 0;
     foreach ($all_fields = $this->getOrderedExportableFields() as $field) {
         switch ($field) {
             case 'role':
                 #$this->csv->addColumn($this->lng->txt($this->getType().'_role_status'));
                 $this->addCol($this->lng->txt($this->getType() . '_role_status'), $row, $col++);
                 break;
             case 'agreement':
                 #$this->csv->addColumn($this->lng->txt('ps_agreement_accepted'));
                 $this->addCol($this->lng->txt('ps_agreement_accepted'), $row, $col++);
                 break;
             default:
                 if (substr($field, 0, 4) == 'udf_') {
                     $field_id = explode('_', $field);
                     include_once 'Services/User/classes/class.ilUserDefinedFields.php';
                     $udf = ilUserDefinedFields::_getInstance();
                     $def = $udf->getDefinition($field_id[1]);
                     #$this->csv->addColumn($def['field_name']);
                     $this->addCol($def['field_name'], $row, $col++);
                 } elseif (substr($field, 0, 4) == 'cdf_') {
                     $field_id = explode('_', $field);
                     #$this->csv->addColumn(ilCourseDefinedFieldDefinition::_lookupName($field_id[1]));
                     $this->addCol(ilCourseDefinedFieldDefinition::_lookupName($field_id[1]), $row, $col++);
                 } else {
                     #$this->csv->addColumn($this->lng->txt($field));
                     $this->addCol($this->lng->txt($field), $row, $col++);
                 }
                 break;
         }
     }
     #$this->csv->addRow();
     $this->addRow();
     // Add user data
     foreach ($this->user_ids as $usr_id) {
         $row++;
         $col = 0;
         $udf_data = new ilUserDefinedData($usr_id);
         foreach ($all_fields as $field) {
             // Handle course defined fields
             if ($this->addUserDefinedField($udf_data, $field, $row, $col)) {
                 $col++;
                 continue;
             }
             if ($this->addCourseField($usr_id, $field, $row, $col)) {
                 $col++;
                 continue;
             }
             switch ($field) {
                 case 'role':
                     switch ($this->user_course_data[$usr_id]['role']) {
                         case IL_CRS_ADMIN:
                             #$this->csv->addColumn($this->lng->txt('crs_admin'));
                             $this->addCol($this->lng->txt('crs_admin'), $row, $col++);
                             break;
                         case IL_CRS_TUTOR:
                             #$this->csv->addColumn($this->lng->txt('crs_tutor'));
                             $this->addCol($this->lng->txt('crs_tutor'), $row, $col++);
                             break;
                         case IL_CRS_MEMBER:
                             #$this->csv->addColumn($this->lng->txt('crs_member'));
                             $this->addCol($this->lng->txt('crs_member'), $row, $col++);
                             break;
                         case IL_GRP_ADMIN:
                             #$this->csv->addColumn($this->lng->txt('il_grp_admin'));
                             $this->addCol($this->lng->txt('il_grp_admin'), $row, $col++);
                             break;
                         case IL_GRP_MEMBER:
                             #$this->csv->addColumn($this->lng->txt('il_grp_member'));
                             $this->addCol($this->lng->txt('il_grp_member'), $row, $col++);
                             break;
                         case 'subscriber':
                             #$this->csv->addColumn($this->lng->txt($this->getType().'_subscriber'));
                             $this->addCol($this->lng->txt($this->getType() . '_subscriber'), $row, $col++);
                             break;
                         default:
                             #$this->csv->addColumn($this->lng->txt('crs_waiting_list'));
                             $this->addCol($this->lng->txt('crs_waiting_list'), $row, $col++);
                             break;
                     }
                     break;
                 case 'agreement':
                     if (isset($this->agreement[$usr_id])) {
                         if ($this->agreement[$usr_id]['accepted']) {
                             #$this->csv->addColumn(ilFormat::formatUnixTime($this->agreement[$usr_id]['acceptance_time'],true));
                             $this->addCol(ilFormat::formatUnixTime($this->agreement[$usr_id]['acceptance_time'], true), $row, $col++);
                         } else {
                             #$this->csv->addColumn($this->lng->txt('ps_not_accepted'));
                             $this->addCol($this->lng->txt('ps_not_accepted'), $row, $col++);
                         }
                     } else {
                         #$this->csv->addColumn($this->lng->txt('ps_not_accepted'));
                         $this->addCol($this->lng->txt('ps_not_accepted'), $row, $col++);
//.........这里部分代码省略.........
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:101,代码来源:class.ilMemberExport.php

示例5: getHTML

 /**
  * render attendance list
  *
  * @return string
  */
 public function getHTML()
 {
     $tpl = new ilTemplate('tpl.attendance_list_print.html', true, true, 'Services/Membership');
     // title
     $time = ilFormat::formatUnixTime(time(), true);
     $tpl->setVariable('TXT_TITLE', $this->title);
     if ($this->description) {
         $tpl->setVariable('TXT_DESCRIPTION', $this->description . " (" . $time . ")");
     } else {
         $tpl->setVariable('TXT_DESCRIPTION', $time);
     }
     // header
     $tpl->setCurrentBlock('head_item');
     foreach ($this->presets as $id => $item) {
         if ($item[1]) {
             $tpl->setVariable('TXT_HEAD', $item[0]);
             $tpl->parseCurrentBlock();
         }
     }
     if ($this->blank_columns) {
         foreach ($this->blank_columns as $blank) {
             $tpl->setVariable('TXT_HEAD', $blank);
             $tpl->parseCurrentBlock();
         }
     }
     // handle members
     $valid_user_ids = $filters = array();
     if ($this->roles) {
         if ($this->has_local_role) {
             $members = array();
             foreach ($this->participants->getMembers() as $member_id) {
                 foreach ($this->participants->getAssignedRoles($member_id) as $role_id) {
                     $members[$role_id][] = $member_id;
                 }
             }
         } else {
             $members = $this->participants->getMembers();
         }
         foreach ($this->roles as $role_id) {
             switch ($this->role_data[$role_id][1]) {
                 case "admin":
                     $valid_user_ids = array_merge($valid_user_ids, $this->participants->getAdmins());
                     break;
                 case "tutor":
                     $valid_user_ids = array_merge($valid_user_ids, $this->participants->getTutors());
                     break;
                     // member/local
                 // member/local
                 default:
                     if (!$this->has_local_role) {
                         $valid_user_ids = array_merge($valid_user_ids, (array) $members);
                     } else {
                         $valid_user_ids = array_merge($valid_user_ids, (array) $members[$role_id]);
                     }
                     break;
             }
         }
     }
     if ($this->include_subscribers) {
         $valid_user_ids = array_merge($valid_user_ids, $this->participants->getSubscribers());
     }
     if ($this->include_waiting_list) {
         $valid_user_ids = array_merge($valid_user_ids, $this->waiting_list->getUserIds());
     }
     if ($this->user_filters) {
         foreach ($this->user_filters as $sub_id => $sub_item) {
             $filters[$sub_id] = (bool) $sub_item[2];
         }
     }
     $valid_user_ids = ilUtil::_sortIds(array_unique($valid_user_ids), 'usr_data', 'lastname', 'usr_id');
     // rows
     foreach ($valid_user_ids as $user_id) {
         if ($this->callback) {
             $user_data = call_user_func_array($this->callback, array($user_id, $filters));
             if (!$user_data) {
                 continue;
             }
             $tpl->setCurrentBlock("row_preset");
             foreach ($this->presets as $id => $item) {
                 if ($item[1]) {
                     switch ($id) {
                         case "name":
                             if (!$user_data[$id]) {
                                 $name = ilObjUser::_lookupName($user_id);
                                 $value = $name["lastname"] . ", " . $name["firstname"];
                                 break;
                             }
                         case "email":
                             if (!$user_data[$id]) {
                                 $value = ilObjUser::_lookupEmail($user_id);
                                 break;
                             }
                         case "login":
                             if (!$user_data[$id]) {
                                 $value = ilObjUser::_lookupLogin($user_id);
//.........这里部分代码省略.........
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:101,代码来源:class.ilAttendanceList.php


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