Server : Apache System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64 User : palandch ( 1163) PHP Version : 7.1.33 Disable Function : NONE Directory : /home/palandch/www/core/model/modx/processors/system/action/ |
<?php /** * Sorts actions from a tree * * @package modx * @subpackage processors.system.action */ class modActionSortProcessor extends modProcessor { public function checkPermissions() { return $this->modx->hasPermission('actions'); } public function getLanguageTopics() { return array('action','menu','namespace'); } public function process() { $data = $this->getProperty('data'); if (empty($data)) return $this->failure(); $data = urldecode($data); $data = $this->modx->fromJSON($data); $nodes = array(); $this->getNodesFormatted($nodes,$data); return $this->success(); } public function getNodesFormatted(&$ar_nodes,$cur_level,$parent = 0) { $order = 0; foreach ($cur_level as $id => $children) { $id = explode('_',$id); $id = $id[1]; $ar_nodes[] = array( 'id' => $id, 'parent' => $parent, 'order' => $order, ); $order++; $this->getNodesFormatted($ar_nodes,$children,$id); } } } return 'modActionSortProcessor';