コード例 #1
0
ファイル: IndexController.php プロジェクト: ngocanh/pimcore
 public function indexAction()
 {
     // check maintenance
     $maintenance_enabled = false;
     $manager = Schedule_Manager_Factory::getManager("maintenance.pid");
     $lastExecution = $manager->getLastExecution();
     if ($lastExecution) {
         if (time() - $lastExecution < 610) {
             // maintenance script should run at least every 10 minutes + a little tolerance
             $maintenance_enabled = true;
         }
     }
     $this->view->maintenance_enabled = Zend_Json::encode($maintenance_enabled);
     // configuration
     $this->view->config = Pimcore_Config::getSystemConfig();
     //mail settings
     $mailIncomplete = false;
     if ($this->view->config->email) {
         $emailSettings = $this->view->config->email->toArray();
         if ($emailSettings['method'] == "sendmail" and !empty($emailSettings['sender']['email'])) {
             $mailIncomplete = true;
         }
         if ($emailSettings['method'] == "smtp" and !empty($emailSettings['sender']['email']) and !empty($emailSettings['smtp']['host'])) {
             $mailIncomplete = true;
         }
     }
     $this->view->mail_settings_incomplete = Zend_Json::encode($mailIncomplete);
     // report configuration
     $this->view->report_config = Pimcore_Config::getReportConfig();
     // customviews config
     $cvConfig = Pimcore_Tool::getCustomViewConfig();
     $cvData = array();
     if ($cvConfig) {
         foreach ($cvConfig as $node) {
             $tmpData = $node;
             $rootNode = Object_Abstract::getByPath($tmpData["rootfolder"]);
             if ($rootNode) {
                 $tmpData["rootId"] = $rootNode->getId();
                 $tmpData["allowedClasses"] = explode(",", $tmpData["classes"]);
                 $tmpData["showroot"] = (bool) $tmpData["showroot"];
                 $cvData[] = $tmpData;
             }
         }
     }
     $this->view->customview_config = $cvData;
     // upload limit
     $max_upload = filesize2bytes(ini_get("upload_max_filesize") . "B");
     $max_post = filesize2bytes(ini_get("post_max_size") . "B");
     $memory_limit = filesize2bytes(ini_get("memory_limit") . "B");
     $upload_mb = min($max_upload, $max_post, $memory_limit);
     $this->view->upload_max_filesize = $upload_mb;
     // live connect
     $liveconnectToken = Pimcore_Liveconnect::getToken();
     $this->view->liveconnectToken = $liveconnectToken;
     // adding css minify filter because of IE issues with CkEditor and more than 31 stylesheets
     if (!PIMCORE_DEVMODE) {
         $front = Zend_Controller_Front::getInstance();
         $front->registerPlugin(new Pimcore_Controller_Plugin_CssMinify(), 800);
     }
 }
コード例 #2
0
 public function adminCssAction()
 {
     // customviews config
     $cvData = Pimcore_Tool::getCustomViewConfig();
     $this->view->customviews = $cvData;
     $this->getResponse()->setHeader("Content-Type", "text/css; charset=UTF-8", true);
 }
コード例 #3
0
ファイル: ObjectController.php プロジェクト: ngocanh/pimcore
 public function treeGetChildsByIdAction()
 {
     $object = Object_Abstract::getById($this->_getParam("node"));
     $object->getPermissionsForUser($this->getUser());
     if ($object->hasChilds()) {
         $limit = intval($this->_getParam("limit"));
         if (!$this->_getParam("limit")) {
             $limit = 100000000;
         }
         $offset = intval($this->_getParam("start"));
         $childsList = new Object_List();
         $condition = "o_parentId = '" . $object->getId() . "'";
         // custom views start
         if ($this->_getParam("view")) {
             $cvConfig = Pimcore_Tool::getCustomViewConfig();
             $cv = $cvConfig[$this->_getParam("view") - 1];
             if ($cv["classes"]) {
                 $cvConditions = array();
                 $cvClasses = explode(",", $cv["classes"]);
                 foreach ($cvClasses as $cvClass) {
                     $cvConditions[] = "o_classId = '" . $cvClass . "'";
                 }
                 $cvConditions[] = "o_type = 'folder'";
                 if (count($cvConditions) > 0) {
                     $condition .= " AND (" . implode(" OR ", $cvConditions) . ")";
                 }
             }
         }
         // custom views end
         $childsList->setCondition($condition);
         $childsList->setLimit($limit);
         $childsList->setOffset($offset);
         $childsList->setOrderKey("o_key");
         $childsList->setOrder("asc");
         $childs = $childsList->load();
         foreach ($childs as $child) {
             $tmpObject = $this->getTreeNodeConfig($child);
             if ($child->isAllowed("list")) {
                 $objects[] = $tmpObject;
             }
         }
     }
     if ($this->_getParam("limit")) {
         $this->_helper->json(array("total" => $object->getChildAmount(), "nodes" => $objects));
     } else {
         $this->_helper->json($objects);
     }
 }
コード例 #4
0
 public function getCustomviewsAction()
 {
     $data = Pimcore_Tool::getCustomViewConfig();
     $this->_helper->json(array("success" => true, "data" => $data));
 }
コード例 #5
0
ファイル: Install.php プロジェクト: weblizards-gmbh/blog
 public function removeCustomView()
 {
     $customViews = Pimcore_Tool::getCustomViewConfig();
     if ($customViews) {
         foreach ($customViews as $key => $view) {
             if ($view['name'] == 'Blog') {
                 unset($customViews[$key]);
                 break;
             }
         }
         $writer = new Zend_Config_Writer_Xml(array('config' => new Zend_Config(array('views' => array('view' => $customViews))), 'filename' => PIMCORE_CONFIGURATION_DIRECTORY . '/customviews.xml'));
         $writer->write();
     }
 }