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


PHP ilUtil::sortArray方法代码示例

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


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

示例1: __construct

 /**
  * Constructor
  */
 function __construct($a_parent_obj, $a_parent_cmd, $a_tree, $a_node_id, $a_tax)
 {
     global $ilCtrl, $lng, $ilAccess, $lng;
     if ($a_node_id == "") {
         $a_node_id = $a_tree->readRootId();
     }
     $this->tree = $a_tree;
     $this->tax = $a_tax;
     $this->node_id = $a_node_id;
     parent::__construct($a_parent_obj, $a_parent_cmd);
     $childs = $this->tree->getChildsByTypeFilter($a_node_id, array("taxn"));
     if ($a_tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
         $childs = ilUtil::sortArray($childs, "order_nr", "asc", false);
     } else {
         $childs = ilUtil::sortArray($childs, "title", "asc", false);
     }
     $this->setData($childs);
     $this->setTitle($lng->txt("tax_nodes"));
     $this->addColumn($this->lng->txt(""), "", "1px", true);
     if ($this->tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
         $this->addColumn($this->lng->txt("tax_order"), "order_nr", "1px");
         $this->setDefaultOrderField("order_nr");
         $this->setDefaultOrderDirection("asc");
     }
     $this->addColumn($this->lng->txt("title"));
     $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
     $this->setRowTemplate("tpl.tax_row.html", "Services/Taxonomy");
     $this->addMultiCommand("deleteItems", $lng->txt("delete"));
     $this->addMultiCommand("moveItems", $lng->txt("move"));
     $this->addCommandButton("saveSettingsAndSorting", $lng->txt("save"));
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:34,代码来源:class.ilTaxonomyTableGUI.php

示例2: __construct

 /**
  * Constructor
  */
 function __construct($a_parent_obj, $a_parent_cmd, $a_obj_id, $a_mode = self::MODE_SCAT)
 {
     global $ilCtrl, $lng, $ilAccess, $lng;
     $ilCtrl->setParameter($a_parent_obj, "tmpmode", $a_mode);
     $this->mode = $a_mode;
     include_once "./Services/Skill/classes/class.ilSkillTree.php";
     $this->skill_tree = new ilSkillTree();
     $this->obj_id = $a_obj_id;
     parent::__construct($a_parent_obj, $a_parent_cmd);
     if ($this->mode == self::MODE_SCAT) {
         $childs = $this->skill_tree->getChildsByTypeFilter($a_obj_id, array("skrt", "skll", "scat", "sktr"));
         $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
         $this->setData($childs);
     } else {
         if ($this->mode == self::MODE_SCTP) {
             $childs = $this->skill_tree->getChildsByTypeFilter($a_obj_id, array("skrt", "sktp", "sctp"));
             $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
             $this->setData($childs);
         }
     }
     if ($this->obj_id != $this->skill_tree->readRootId()) {
         //			$this->setTitle(ilSkillTreeNode::_lookupTitle($this->obj_id));
     }
     $this->setTitle($lng->txt("skmg_items"));
     $this->addColumn($this->lng->txt(""), "", "1px", true);
     $this->addColumn($this->lng->txt("type"), "", "1px");
     $this->addColumn($this->lng->txt("skmg_order"), "", "1px");
     $this->addColumn($this->lng->txt("title"));
     $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
     $this->setRowTemplate("tpl.skill_cat_row.html", "Services/Skill");
     $this->addMultiCommand("deleteNodes", $lng->txt("delete"));
     $this->addMultiCommand("cutItems", $lng->txt("cut"));
     $this->addMultiCommand("copyItems", $lng->txt("copy"));
     $this->addCommandButton("saveOrder", $lng->txt("skmg_save_order"));
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:38,代码来源:class.ilSkillCatTableGUI.php

示例3: getItems

 /**
  * Get items from user clipboard
  */
 function getItems()
 {
     global $ilUser;
     $objs = $ilUser->getClipboardObjects("mob");
     $objs2 = $ilUser->getClipboardObjects("incl");
     $objs = array_merge($objs, $objs2);
     $objs = ilUtil::sortArray($objs, $_GET["sort_by"], $_GET["sort_order"]);
     $this->setData($objs);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:12,代码来源:class.ilClipboardTableGUI.php

示例4: _getLastExportFileInformation

 /**
  * Get last export file information
  *
  * @param int $a_obj_id object id
  * @param string $a_type export type ("xml", "html", ...), default "xml"
  * @param string $a_obj_type object type (optional, if not given, type is looked up)
  */
 static function _getLastExportFileInformation($a_obj_id, $a_type = "", $a_obj_type = "")
 {
     $files = ilExport::_getExportFiles($a_obj_id, $a_type, $a_obj_type);
     if (is_array($files)) {
         $files = ilUtil::sortArray($files, "timestamp", "desc");
         return $files[0];
     }
     return false;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:16,代码来源:class.ilExport.php

示例5: getItems

 /**
  * Get items of current folder
  */
 function getItems()
 {
     $std_alias_item = new ilMediaAliasItem($this->pc_media_object->dom, $this->pc_media_object->hier_id, "Standard", $this->pc_media_object->getPcId(), $this->parent_node_name);
     $areas = $std_alias_item->getMapAreas();
     foreach ($areas as $k => $a) {
         $areas[$k]["title"] = $a["Link"]["Title"];
     }
     $areas = ilUtil::sortArray($areas, "title", "asc", false, true);
     $this->setData($areas);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:13,代码来源:class.ilPCImageMapTableGUI.php

示例6: getMaterials

 /**
  * Get materials
  *
  * @param
  * @return
  */
 function getMaterials()
 {
     $materials = array();
     $items = $this->item_group_items->getAssignableItems();
     foreach ($items as $item) {
         $item["sorthash"] = (int) (!in_array($item['ref_id'], $this->items)) . $item["title"];
         $materials[] = $item;
     }
     $materials = ilUtil::sortArray($materials, "sorthash", "asc");
     $this->setData($materials);
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:17,代码来源:class.ilItemGroupItemsTableGUI.php

示例7: read

 /**
  * read style folder data
  */
 function read()
 {
     global $ilDB;
     parent::read();
     // get styles of style folder
     $q = "SELECT * FROM style_folder_styles, style_data WHERE folder_id = " . $ilDB->quote($this->getId(), "integer") . " AND style_id = style_data.id";
     $style_set = $ilDB->query($q);
     $this->styles = array();
     while ($style_rec = $ilDB->fetchAssoc($style_set)) {
         $this->styles[$style_rec["style_id"]] = array("id" => $style_rec["style_id"], "title" => ilObject::_lookupTitle($style_rec["style_id"]), "category" => $style_rec["category"]);
     }
     $this->styles = ilUtil::sortArray($this->styles, "title", "asc", false, true);
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:16,代码来源:class.ilObjStyleSettings.php

示例8: getGroups

 /**
  * Get pages for list.
  */
 function getGroups()
 {
     global $lng;
     $data = array();
     $subitems = ilObjRepositorySettings::getNewItemGroupSubItems();
     if ($subitems[0]) {
         ilUtil::sendInfo(sprintf($lng->txt("rep_new_item_group_unassigned_subitems"), sizeof($subitems[0])));
         unset($subitems[0]);
     }
     foreach (ilObjRepositorySettings::getNewItemGroups() as $item) {
         $data[] = array("id" => $item["id"], "pos" => $item["pos"], "title" => $item["title"], "type" => $item["type"], "subitems" => sizeof($subitems[$item["id"]]));
     }
     $data = ilUtil::sortArray($data, "pos", "asc", true);
     $this->setData($data);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:18,代码来源:class.ilNewItemGroupTableGUI.php

示例9: getDataFromDb

 /**
  * Get data and put it into an array
  */
 function getDataFromDb()
 {
     global $tree, $objDefinition;
     $nodes = $tree->getSubTree($tree->getNodeData($this->parent_ref_id));
     $materials = array();
     foreach ($nodes as $node) {
         // No side blocks here
         if ($node['child'] == $this->parent_ref_id || $objDefinition->isSideBlock($node['type']) || in_array($node['type'], array('sess', 'itgr', 'rolf'))) {
             continue;
         }
         if ($node['type'] == 'rolf') {
             continue;
         }
         $node["sorthash"] = (int) (!in_array($node['ref_id'], $this->getMaterialItems())) . $node["title"];
         $materials[] = $node;
     }
     $materials = ilUtil::sortArray($materials, "sorthash", "ASC");
     $this->setData($materials);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:22,代码来源:class.ilSessionMaterialsTableGUI.php

示例10: renderPageEmbeddedBlocks

 /**
  * Render Page Embedded Blocks
  */
 function renderPageEmbeddedBlocks()
 {
     global $lng;
     // item groups
     if (is_array($this->embedded_block["itgr"])) {
         $item_groups = array();
         if (is_array($this->items["itgr"])) {
             foreach ($this->items["itgr"] as $ig) {
                 $item_groups[$ig["ref_id"]] = $ig;
             }
         }
         foreach ($this->embedded_block["itgr"] as $ref_id) {
             if (isset($item_groups[$ref_id])) {
                 $this->renderItemGroup($item_groups[$ref_id]);
             }
         }
     }
     // type specific blocks
     if (is_array($this->embedded_block["type"])) {
         foreach ($this->embedded_block["type"] as $k => $type) {
             if (is_array($this->items[$type]) && $this->renderer->addTypeBlock($type)) {
                 // :TODO: obsolete?
                 if ($type == 'sess') {
                     $this->items['sess'] = ilUtil::sortArray($this->items['sess'], 'start', 'ASC', true, true);
                 }
                 $position = 1;
                 foreach ($this->items[$type] as $k => $item_data) {
                     if (!$this->renderer->hasItem($item_data["child"])) {
                         $html = $this->renderItem($item_data, $position++);
                         if ($html != "") {
                             $this->renderer->addItemToBlock($type, $item_data["type"], $item_data["child"], $html);
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:41,代码来源:class.ilContainerContentGUI.php

示例11: sortOrderDefault

 /**
  * Position and order sort order for new object without position in manual sorting type
  *
  * @param $items
  * @return array
  */
 private function sortOrderDefault($items)
 {
     $no_position = array();
     foreach ($items as $key => $item) {
         if ($item["position"] == self::ORDER_DEFAULT) {
             $no_position[] = array("key" => $key, "title" => $item["title"], "create_date" => $item["create_date"], "start" => $item["start"]);
         }
     }
     if (!count($no_position)) {
         return $items;
     }
     switch ($this->getSortingSettings()->getSortNewItemsOrder()) {
         case ilContainer::SORT_NEW_ITEMS_ORDER_TITLE:
             $no_position = ilUtil::sortArray((array) $no_position, 'title', $this->getSortingSettings()->getSortDirection() == ilContainer::SORT_DIRECTION_ASC ? 'asc' : 'desc', TRUE);
             break;
         case ilContainer::SORT_NEW_ITEMS_ORDER_CREATION:
             $no_position = ilUtil::sortArray((array) $no_position, 'create_date', $this->getSortingSettings()->getSortDirection() == ilContainer::SORT_DIRECTION_ASC ? 'asc' : 'desc', TRUE);
             break;
         case ilContainer::SORT_NEW_ITEMS_ORDER_ACTIVATION:
             $no_position = ilUtil::sortArray((array) $no_position, 'start', $this->getSortingSettings()->getSortDirection() == ilContainer::SORT_DIRECTION_ASC ? 'asc' : 'desc', TRUE);
     }
     $count = $this->getSortingSettings()->getSortNewItemsPosition() == ilContainer::SORT_NEW_ITEMS_POSITION_TOP ? 0 : 900000;
     foreach ($no_position as $values) {
         $items[$values["key"]]["position"] = $count;
         $count++;
     }
     return $items;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:34,代码来源:class.ilContainerSorting.php

示例12: exportData

 /**
  * Export the Data
  *
  * @param type $format
  * @param type $send
  */
 public function exportData($format, $send = false)
 {
     if ($this->dataExists()) {
         // #9640: sort
         if (!$this->getExternalSorting() && $this->enabled["sort"]) {
             $this->determineOffsetAndOrder(true);
             $this->row_data = ilUtil::sortArray($this->row_data, $this->getOrderField(), $this->getOrderDirection(), $this->numericOrdering($this->getOrderField()));
         }
         $filename = "export";
         switch ($format) {
             default:
             case self::EXPORT_EXCEL:
                 include_once "./Services/Excel/classes/class.ilExcelUtils.php";
                 include_once "./Services/Excel/classes/class.ilExcelWriterAdapter.php";
                 $adapter = new ilExcelWriterAdapter($filename . ".xls", $send);
                 $workbook = $adapter->getWorkbook();
                 $worksheet = $workbook->addWorksheet();
                 $row = 0;
                 ob_start();
                 $this->fillMetaExcel($worksheet, $row);
                 $this->fillHeaderExcel($worksheet, $row);
                 foreach ($this->row_data as $set) {
                     $row++;
                     $this->fillRowExcel($worksheet, $row, $set);
                 }
                 ob_end_clean();
                 $workbook->close();
                 break;
             case self::EXPORT_CSV:
                 include_once "./Services/Utilities/classes/class.ilCSVWriter.php";
                 $csv = new ilCSVWriter();
                 $csv->setSeparator(";");
                 ob_start();
                 $this->fillMetaCSV($csv);
                 $this->fillHeaderCSV($csv);
                 foreach ($this->row_data as $set) {
                     $this->fillRowCSV($csv, $set);
                 }
                 ob_end_clean();
                 if ($send) {
                     $filename .= ".csv";
                     header("Content-type: text/comma-separated-values");
                     header("Content-Disposition: attachment; filename=\"" . $filename . "\"");
                     header("Expires: 0");
                     header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
                     header("Pragma: public");
                     echo $csv->getCSVString();
                 } else {
                     file_put_contents($filename, $csv->getCSVString());
                 }
                 break;
             case self::EXPORT_PDF:
                 include_once "Customizing/global/plugins/Services/Repository/RepositoryObject/RoomSharing/classes/appointments/bookings/class.ilRoomSharingBookingsExportTableGUI.php";
                 $exportTable = new ilRoomSharingBookingsExportTableGUI($this->parent_obj, 'showBookings', $this->ref_id);
                 include_once "Customizing/global/plugins/Services/Repository/RepositoryObject/RoomSharing/classes/export/class.ilRoomSharingPDFCreator.php";
                 $staff = $exportTable->getTableHTML();
                 ilRoomSharingPDFCreator::generatePDF($exportTable->getTableHTML(), 'D', 'file.pdf');
                 break;
         }
         if ($send) {
             exit;
         }
     }
 }
开发者ID:studer-raimann,项目名称:RoomSharing,代码行数:70,代码来源:class.ilRoomSharingBookingsTableGUI.php

示例13: sortResult

 public function sortResult($result)
 {
     if ($this->sort_direction != '' && $this->sort_field != '') {
         switch ($this->sort_field) {
             case 'price':
                 $numeric_sort = true;
                 break;
             default:
                 $numeric_sort = false;
                 break;
         }
         $result = ilUtil::sortArray($result, $this->sort_field, $this->sort_direction, $numeric_sort);
     }
     return $result;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:15,代码来源:class.ilShopResultPresentationGUI.php

示例14: renderToolbar

 /**
  * Render workspace toolbar (folder navigation, add subobject)
  */
 protected function renderToolbar()
 {
     global $lng, $ilCtrl, $objDefinition, $tpl, $ilSetting;
     $settings_map = array("blog" => "blogs", "file" => "files", "tstv" => "certificates", "excv" => "certificates", "webr" => "links");
     $root = $this->tree->getNodeData($this->node_id);
     $subtypes = $objDefinition->getCreatableSubObjects($root["type"], ilObjectDefinition::MODE_WORKSPACE);
     if ($subtypes) {
         // :TODO: permission checks?
         $subobj = array();
         foreach (array_keys($subtypes) as $type) {
             if (isset($settings_map[$type]) && $ilSetting->get("disable_wsp_" . $settings_map[$type])) {
                 continue;
             }
             $class = $objDefinition->getClassName($type);
             $subobj[] = array("value" => $type, "title" => $lng->txt("wsp_type_" . $type), "img" => ilObject::_getIcon("", "tiny", $type), "alt" => $lng->txt("wsp_type_" . $type));
         }
         $subobj = ilUtil::sortArray($subobj, "title", 1);
         $lng->loadLanguageModule("cntr");
         $tpl->setCreationSelector($ilCtrl->getFormAction($this), $subobj, "create", $lng->txt("add"));
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:24,代码来源:class.ilPersonalWorkspaceGUI.php

示例15: getAggregatedChildNewsData

 /**
  * Get news aggregation for child objects (e.g. for categories)
  */
 function getAggregatedChildNewsData($a_ref_id, $a_only_public = false, $a_time_period = 0, $a_prevent_aggregation = false, $a_starting_date = "", $a_no_auto_generated = false)
 {
     global $tree, $ilAccess;
     // get news of parent object
     $data = $this->getNewsForRefId($a_ref_id, $a_only_public, true, $a_time_period, true, false, false, $a_no_auto_generated);
     foreach ($data as $k => $v) {
         $data[$k]["ref_id"] = $a_ref_id;
     }
     // get childs
     $nodes = $tree->getChilds($a_ref_id);
     // no check, for which of the objects any news are available
     $obj_ids = array();
     foreach ($nodes as $node) {
         $obj_ids[] = $node["obj_id"];
     }
     $news_obj_ids = ilNewsItem::filterObjIdsPerNews($obj_ids, $a_time_period, $a_starting_date);
     //$news_obj_ids = $obj_ids;
     // get news for all subtree nodes
     $contexts = array();
     foreach ($nodes as $node) {
         // only go on, if news are available
         if (!in_array($node["obj_id"], $news_obj_ids)) {
             continue;
         }
         if (!$a_only_public && !$ilAccess->checkAccess("read", "", $node["child"])) {
             continue;
         }
         $ref_id[$node["obj_id"]] = $node["child"];
         $contexts[] = array("obj_id" => $node["obj_id"], "obj_type" => $node["type"]);
     }
     $news = $this->queryNewsForMultipleContexts($contexts, $a_only_public, $a_time_period, $a_starting_date, $a_no_auto_generated);
     foreach ($news as $k => $v) {
         $news[$k]["ref_id"] = $ref_id[$v["context_obj_id"]];
     }
     $data = ilNewsItem::mergeNews($data, $news);
     // sort and return
     $data = ilUtil::sortArray($data, "creation_date", "desc", false, true);
     if (!$a_prevent_aggregation) {
         $data = $this->aggregateFiles($data, $a_ref_id);
     }
     return $data;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:45,代码来源:class.ilNewsItem.php


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