function indexAction() { // retrieve the ID of the requested page $pageID = $this->view->pageID = $this->_getParam('ID'); $pageDetails = new PagesIndex(); $pageDetailsSelect = $pageDetails->select(); $pageDetailsSelect->where('PI_PageID = ?', $pageID)->where('PI_LanguageID = ?', $this->_defaultEditLanguage); $pageDetailsData = $pageDetails->fetchRow($pageDetailsSelect)->toArray(); $this->view->assign("pageTitle", $pageDetailsData["PI_PageTitle"]); $authData = $this->view->user; $authID = $authData['EU_ID']; if (Cible_FunctionsAdministrators::checkAdministratorPageAccess($authID, $pageID, "data")) { $authData = $this->view->user; $authID = $authData['EU_ID']; if (Cible_FunctionsAdministrators::checkAdministratorPageAccess($authID, $pageID, "structure")) { $this->view->assign('hasAccessToStructure', true); } // Retrieve the page view layout $page = new Pages(); $page_select = $page->select()->setIntegrityCheck(false); $page_select->from('Pages')->join('Views', 'Pages.P_ViewID = Views.V_ID')->where('P_ID = ?', $pageID); $page_info = Cible_FunctionsPages::getPageViewDetails($pageID); $template_file = 'index/' . $page_info['V_Path']; $_zone_count = $page_info['V_ZoneCount']; // make a request to get all the blocks to be displayed $blocks = new Blocks(); $select = $blocks->select()->setIntegrityCheck(false); $select->from('Blocks')->join('Modules', 'Modules.M_ID = Blocks.B_ModuleID')->join('Pages', 'Blocks.B_PageID = P_ID')->join('BlocksIndex', 'Blocks.B_ID = BlocksIndex.BI_BlockID')->where('Blocks.B_PageID = ?', $pageID)->where('BlocksIndex.BI_LanguageID = ?', Zend_Registry::get('languageID'))->order('Blocks.B_Position ASC'); //Send the results to the view $rows = $blocks->fetchAll($select); $_blocks = array(); foreach ($rows as $row) { // create the placeholder object if not already defined if (!isset($_blocks[$row['B_ZoneID']])) { $_blocks[$row['B_ZoneID']] = array(); } $_blocks[$row['B_ZoneID']][] = $row->toArray(); } $this->view->assign('template_file', $template_file); $this->view->assign('zone_count', $_zone_count); $this->view->assign('blocks', $_blocks); // Load the modules in the view $Modules = new Modules(); $modules = $Modules->fetchAll(); $this->view->assign('modules', $modules->toArray()); } else { $this->view->assign('template_file', ""); $this->view->assign('error_message_permission', $this->view->getCibleText('error_message_permission')); } }
function indexAction() { $modules_table = new Modules("nuts"); $request = new Bolts_Request($this->getRequest()); if ($request->has("id") and $request->has("perform")) { switch ($request->perform) { case "enable": if (!$modules_table->isEnabled($request->id)) { if ($modules_table->enable($request->id)) { if (!is_null($modules_table->success)) { $this->view->success = $modules_table->success; } else { $this->view->success = "Module \"" . $request->id . "\" enabled."; } } } else { $this->view->notice = "Module \"" . $request->id . "\" is already enabled."; } break; case "disable": if ($modules_table->isEnabled($request->id)) { if ($modules_table->disable($request->id)) { if (!is_null($modules_table->success)) { $this->view->success = $modules_table->success; } else { $this->view->success = "Module \"" . $request->id . "\" disabled."; } } } else { $this->view->notice = "Module \"" . $request->id . "\" is already disabled."; } break; case "install": if (!$modules_table->exists($request->id)) { if ($modules_table->install($request->id)) { if (!is_null($modules_table->success)) { $this->view->success = $modules_table->success; } else { $this->view->success = "Module \"" . $request->id . "\" installed."; } } } else { $this->view->notice = "Module \"" . $request->id . "\" is already installed."; } break; case "uninstall": if ($modules_table->exists($request->id)) { if ($modules_table->disable($request->id)) { if ($modules_table->uninstall($request->id)) { if (!is_null($modules_table->success)) { $this->view->success = $modules_table->success; } else { $this->view->success = "Module \"" . $request->id . "\" disabled and uninstalled."; } } } } else { $this->view->notice = "Module \"" . $request->id . "\" is not installed."; } break; } if (count($modules_table->errors) > 0) { $this->view->errors = $modules_table->errors; } if (!is_null($modules_table->notice)) { $this->view->notice = $modules_table->notice; } } $basepath = Zend_Registry::get('basepath'); $module_dir = $basepath . "/nuts"; $o_module_dir = dir($module_dir); $available_modules = array(); while (false !== ($entry = $o_module_dir->read())) { if (substr($entry, 0, 1) != ".") { if ($entry != "default") { $full_dir = $module_dir . "/" . $entry; if (file_exists($full_dir . "/module.ini") and !$modules_table->exists($entry)) { $tmp_module = $modules_table->parseIni($entry); $tmp_module['id'] = $entry; $tmp_module['available'] = true; $available_modules[] = $tmp_module; } } } } $o_module_dir->close(); $tmp_modules = array(); $modules = $modules_table->fetchAll(null, "id"); if (count($modules) > 0) { $tmp_modules = array(); foreach ($modules as $module) { $module = $module->toArray(); try { $config = $modules_table->parseIni($module['id']); foreach ($config as $key => $val) { $module[$key] = $val; } $module['available'] = false; $tmp_modules[] = $module; } catch (Exception $e) { Bolts_Log::report("Could not set up " . $module, $e, Zend_Log::ERR); } } } $this->view->modules = array_merge($tmp_modules, $available_modules); }
// check for database changes $modules_table = new Modules('core'); $modules_table->upgradeDatabase("default"); $modules_table->setDefaultConfig("default"); $config_table = new Config(); $config_array = $config_table->fetchall()->toArray(); foreach ($config_array as $config_param) { Zend_Registry::set($config_param['ckey'], $config_param['value']); } // // Make session use the DB // Zend_Session::setSaveHandler(new RivetyCore_SessionSaveHandler()); // Zend_Session::start(); // Get the list of modules from the db $modules_table = new Modules('modules'); $enabled_modules = $modules_table->fetchAll("is_enabled = 1"); if (count($enabled_modules) > 0) { foreach ($enabled_modules as $module) { $full_dir = $module_dir . "/" . $module->id; if ($modules_table->isEnabled($module->id)) { $modules_table->setup($module->id); $smarty_plugins_dir = $full_dir . '/smarty_plugins'; // if there are any OTHER smarty plugin dirs in other modules, convert smarty_plugin_dirs to an array and add the default if (is_dir($smarty_plugins_dir)) { $tmp_dir = $smarty_plugins_dirs; if (is_array($smarty_plugins_dirs)) {