public function getContent($args) { switch ($args['pluginid']) { case 1: //$uid = $args['uid']; // Get matching news stories published since last newsletter // No selection on categories made !! $items = ModUtil::apiFunc('News', 'user', 'getall', array('numitems' => $this->getVar('itemsperpage'), 'status' => 0, 'from' => DateUtil::getDatetime($args['last']), 'filterbydate' => true)); if ($items != false) { if ($args['contenttype'] == 't') { $counter = 0; $output.="\n"; foreach ($items as $item) { $counter++; $output .= $counter . '. ' . $item['title'] . " (" . $this->__f('by %1$s on %2$s', array($item['contributor'], DateUtil::formatDatetime($item['from'], 'datebrief'))) . ")\n"; } } else { $render = Zikula_View::getInstance('News'); $render->assign('readperm', SecurityUtil::checkPermission('News::', "::", ACCESS_READ)); $render->assign('articles', $items); $output = $render->fetch('mailz/listarticles.tpl'); } } else { $output = $this->__f('No News publisher articles since last newsletter on %s.', DateUtil::formatDatetime($args['last'], 'datebrief')) . "\n"; } return $output; } return ''; }
/** * Validate the data for a category * * @param array $data The data for the category. * * @return boolean true/false Whether the provided data is valid. */ public static function validateCategoryData($data) { $view = \Zikula_View::getInstance(); if (empty($data['name'])) { $msg = $view->__('Error! You did not enter a name for the category.'); \LogUtil::registerError($msg); return false; } if (empty($data['parent_id'])) { $msg = $view->__('Error! You did not provide a parent for the category.'); \LogUtil::registerError($msg); return false; } // get entity manager $em = \ServiceUtil::get('doctrine')->getManager(); // process name $data['name'] = self::processCategoryName($data['name']); // check that we don't have another category with the same name // on the same level $dql = "\n SELECT count(c.id)\n FROM Zikula\\Core\\Doctrine\\Entity\\Category c\n WHERE c.name = '" . $data['name'] . "'\n AND c.parent = " . $data['parent_id']; if (isset($data['id']) && is_numeric($data['id'])) { $dql .= " AND c.id <> " . $data['id']; } $query = $em->createQuery($dql); $exists = (int) $query->getSingleScalarResult(); if ($exists > 0) { $msg = $view->__f('Category %s must be unique under parent', $data['name']); \LogUtil::registerError($msg); return false; } return true; }
/** * Post constructor hook. * * @return void */ public function setup() { $this->view = \Zikula_View::getInstance(self::MODULENAME, false); // set caching off $this->_em = \ServiceUtil::get('doctrine.entitymanager'); $this->domain = \ZLanguage::getModuleDomain(self::MODULENAME); }
/** * Delete a topic from the database * @author: Albert Pï¿œrez Monfort (aperezm@xtec.cat) * @param: args The id of the topic * @return: true if success and false if fails */ public function esborra($args) { $tid = FormUtil::getPassedValue('tid', isset($args['tid']) ? $args['tid'] : null, 'POST'); // Security check if (!SecurityUtil::checkPermission('IWnoteboard::', '::', ACCESS_ADMIN)) { return LogUtil::registerPermissionError(); } // Argument check if (!isset($tid) || !is_numeric($tid)) { return LogUtil::registerError($this->__('Error! Could not do what you wanted. Please check your input.')); } // Get the item $item = ModUtil::apiFunc('IWnoteboard', 'user', 'gettema', array('tid' => $tid)); if (!$item) { return LogUtil::registerError($this->__('No such item found.')); } if (!DBUtil::deleteObjectByID('IWnoteboard_topics', $tid, 'tid')) { return LogUtil::registerError($this->__('Error! Sorry! Deletion attempt failed.')); } // The item has been deleted, so we clear all cached pages of this item. $view = Zikula_View::getInstance('IWnoteboard'); $view->clear_cache(null, $tid); return true; }
/** * Validate the data for a category * * @param array $data The data for the category. * * @return boolean true/false Whether the provided data is valid. * * @throws \InvalidArgumentException Thrown if no category name is provided or * if no parent is defined for the category * @throws \RuntimeException Thrown if a category of the same anme already exists under the parent */ public static function validateCategoryData($data) { $view = \Zikula_View::getInstance(); if (empty($data['name'])) { throw new \InvalidArgumentException(__('Error! You did not enter a name for the category.')); } if (empty($data['parent_id'])) { throw new \InvalidArgumentException('Error! You did not provide a parent for the category.'); } // get entity manager $em = \ServiceUtil::get('doctrine.entitymanager'); // process name $data['name'] = self::processCategoryName($data['name']); // check that we don't have another category with the same name // on the same level $qb = $em->createQueryBuilder(); $qb->select('count(c.id)')->from('ZikulaCategoriesModule:CategoryEntity', 'c')->where('c.name = :name')->andWhere('c.parent = :parentid')->setParameter('name', $data['name'])->setParameter('parentid', $data['parent_id']); if (isset($data['id']) && is_numeric($data['id'])) { $qb->andWhere('c.id <> :id')->setParameter('id', $data['id']); } $query = $qb->getQuery(); $exists = (int) $query->getSingleScalarResult(); if ($exists > 0) { throw new \RuntimeException($view->__f('Category %s must be unique under parent', $data['name'])); } return true; }
public function display($blockinfo) { // Security check (1) if (!SecurityUtil::checkPermission('IWmenu:topblock:', "$blockinfo[title]::", ACCESS_READ)) { return false; } // Check if the module is available. (2) if (!ModUtil::available('IWmenu')) { return false; } // Get variables from content block (3) //Get cached user menu $uid = is_null(UserUtil::getVar('uid')) ? '-1' : UserUtil::getVar('uid'); //Generate menu $menu_estructure = ModUtil::apiFunc('IWmenu', 'user', 'getMenuStructure'); // Defaults (4) if (empty($menu_estructure)) { return false; } // Create output object (6) $view = Zikula_View::getInstance('IWmenu'); // assign your data to to the template (7) $view->assign('menu', $menu_estructure); // Populate block info and pass to theme (8) $menu = $view->fetch('IWmenu_block_top.htm'); //$blockinfo['content'] = $menu; //return BlockUtil::themesideblock($blockinfo); return $menu; }
public function search(){ // Check permission $this->throwForbiddenUnless(SecurityUtil::checkPermission('Llicencies::', '::', ACCESS_READ)); //path to zk jquery lib $js = new JCSSUtil; $scripts = $js->scriptsMap(); $jquery = $scripts['jquery']['path']; // Omplim les llistes desplegables del fromulari $cursos = ModUtil::apiFunc('Llicencies', 'user', 'getYears'); $temes = ModUtil::apiFunc('Llicencies', 'user', 'getTopicList'); $subtemes = ModUtil::apiFunc('Llicencies', 'user', 'getSubtopicList'); $tipus = ModUtil::apiFunc('Llicencies', 'user', 'getTypeList'); $view = Zikula_View::getInstance($this->name); $view->assign('jquery' , $jquery); $view->assign('cursos' , $cursos); $view->assign('temes' , $temes); $view->assign('subtemes', $subtemes); $view->assign('tipus' , $tipus); $view->assign('admin' , false); // Carreagr el formulari per a fer la cerca de llicències d'estudi return $this->view->display('Llicencies_main.tpl'); }
/** * Zikula_View modifier to turn a boolean value into a suitable language string * * Example * * {$myvar|yesno|safetext} returns Yes if $myvar = 1 and No if $myvar = 0 * * @param string $string The contents to transform. * @param boolean $images Display the yes/no response as tick/cross. * * @return string Rhe modified output. */ function smarty_modifier_yesno($string, $images = false) { if ($string != '0' && $string != '1') { return $string; } if ($images) { $view = Zikula_View::getInstance(); require_once $view->_get_plugin_filepath('function', 'img'); $params = array('modname' => 'core', 'set' => 'icons/extrasmall'); } if ((bool) $string) { if ($images) { $params['src'] = 'button_ok.png'; $params['alt'] = $params['title'] = __('Yes'); return smarty_function_img($params, $view); } else { return __('Yes'); } } else { if ($images) { $params['src'] = 'button_cancel.png'; $params['alt'] = $params['title'] = __('No'); return smarty_function_img($params, $view); } else { return __('No'); } } }
public function pageLock($args) { $lockName = $args['lockName']; $returnUrl = (array_key_exists('returnUrl', $args) ? $args['returnUrl'] : null); $ignoreEmptyLock = (array_key_exists('ignoreEmptyLock', $args) ? $args['ignoreEmptyLock'] : false); $uname = UserUtil::getVar('uname'); $lockedHtml = ''; if (!empty($lockName) || !$ignoreEmptyLock) { PageUtil::AddVar('javascript', 'zikula.ui'); PageUtil::AddVar('javascript', 'system/PageLock/javascript/pagelock.js'); PageUtil::AddVar('stylesheet', ThemeUtil::getModuleStylesheet('pagelock')); $lockInfo = ModUtil::apiFunc('pagelock', 'user', 'requireLock', array('lockName' => $lockName, 'lockedByTitle' => $uname, 'lockedByIPNo' => $_SERVER['REMOTE_ADDR'])); $hasLock = $lockInfo['hasLock']; if (!$hasLock) { $view = Zikula_View::getInstance('pagelock'); $view->assign('lockedBy', $lockInfo['lockedBy']); $lockedHtml = $view->fetch('PageLock_lockedwindow.tpl'); } } else { $hasLock = true; } $html = "<script type=\"text/javascript\">/* <![CDATA[ */ \n"; if (!empty($lockName)) { if ($hasLock) { $html .= "document.observe('dom:loaded', PageLock.UnlockedPage);\n"; } else { $html .= "document.observe('dom:loaded', PageLock.LockedPage);\n"; } } $lockedHtml = str_replace("\n", "", $lockedHtml); $lockedHtml = str_replace("\r", "", $lockedHtml); // Use "PageLockLifetime*2/3" to add a good margin to lock timeout when pinging // disabled due to #2556 and #2745 // $returnUrl = DataUtil::formatForDisplayHTML($returnUrl); $html .= " PageLock.LockName = '$lockName'; PageLock.ReturnUrl = '$returnUrl'; PageLock.PingTime = " . (PageLockLifetime*2/3) . "; PageLock.LockedHTML = '" . $lockedHtml . "'; /* ]]> */</script>"; PageUtil::addVar('header', $html); return true; }
public function getView() { if (!$this->view) { $this->view = Zikula_View::getInstance($this->name); } return $this->view; }
/** * Set view property. * * @param Zikula_View $view Default null means new Render instance for this module name. * * @return Zikula_AbstractController */ protected function setView(Zikula_View $view = null) { if (is_null($view)) { $view = Zikula_View::getInstance($this->getName()); } $this->view = $view; return $this; }
/** * Gets qv summary information * * @author: Sara Arjona Téllez (sarjona@xtec.cat) */ function IWqv_qvsummaryblock_display($row) { // Security check if (!SecurityUtil::checkPermission('IWqv:summaryBlock:', $row['title'] . "::", ACCESS_READ) || !UserUtil::isLoggedIn()) { return false; } $uid = UserUtil::getVar('uid'); if (!isset($uid)) $uid = '-1'; // Get the qvsummary saved in the user vars. It is renovate every 10 minutes $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); $exists = ModUtil::apiFunc('IWmain', 'user', 'userVarExists', array('name' => 'qvsummary', 'module' => 'IWqv', 'uid' => $uid, 'sv' => $sv)); if ($exists) { $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); $s = ModUtil::func('IWmain', 'user', 'userGetVar', array('uid' => $uid, 'name' => 'qvsummary', 'module' => 'IWqv', 'sv' => $sv, 'nult' => true)); } else { $teacherassignments = ModUtil::apiFunc('IWqv', 'user', 'getall', array("teacher" => $uid)); $studentassignments = ModUtil::apiFunc('IWqv', 'user', 'getall', array("student" => $uid)); if (empty($teacherassignments) && empty($studentassignments)) { } $view = Zikula_View::getInstance('IWqv', false); $view->assign('teacherassignments', $teacherassignments); $view->assign('studentassignments', $studentassignments); $view->assign('isblock', true); $s = $view->fetch('IWqv_block_summary.htm'); if (empty($teacherassignments) && empty($studentassignments)) { $s = ''; } //Copy the block information into user vars $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); ModUtil::func('IWmain', 'user', 'userSetVar', array('uid' => $uid, 'name' => 'qvsummary', 'module' => 'IWqv', 'sv' => $sv, 'value' => $s, 'lifetime' => '2000')); } if ($s == '') { return false; } $row['content'] = $s; return BlockUtil::themesideblock($row); }
/** * Gets topics information * * @author Albert Pérez Monfort (aperezm@xtec.cat) * @author Josep Ferràndiz Farré (jferran6@xtec.cat) */ public function display($row) { // Security check if (!SecurityUtil::checkPermission('IWmyrole::', "::", ACCESS_ADMIN)) { return false; } $uid = UserUtil::getVar('uid'); //Check if user belongs to change group. If not the block is not showed $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); $isMember = ModUtil::func('IWmain', 'user', 'isMember', array('sv' => $sv, 'gid' => ModUtil::getVar('IWmyrole', 'rolegroup'), 'uid' => $uid)); if (!$isMember) { return false; } $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); $uidGroups = ModUtil::func('IWmain', 'user', 'getAllUserGroups', array('sv' => $sv, 'uid' => $uid)); foreach ($uidGroups as $g) { $originalGroups[$g['id']] = 1; } $view = Zikula_View::getInstance('IWmyrole', false); // Gets the groups $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); $allGroups = ModUtil::func('IWmain', 'user', 'getAllGroups', array('sv' => $sv, 'less' => ModUtil::getVar('IWmyrole', 'rolegroup'))); $groupsNotChangeable = ModUtil::getVar('IWmyrole', 'groupsNotChangeable'); foreach ($allGroups as $group) { if (strpos($groupsNotChangeable, '$' . $group['id'] . '$') == false) $groupsArray[] = $group; } $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); $invalidChange = ModUtil::func('IWmain', 'user', 'userGetVar', array('uid' => $uid, 'name' => 'invalidChange', 'module' => 'IWmyrole', 'nult' => true, 'sv' => $sv)); $view->assign('groups', $groupsArray); $view->assign('invalidChange', $invalidChange); $view->assign('roleGroups', $originalGroups); $s = $view->fetch('IWmyrole_block_change.htm'); $row['content'] = $s; return BlockUtil::themesideblock($row); }
/** * Display the search form. * * @param array $args List of arguments. * * @return string Template output */ public function options(array $args = array()) { if (!SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_READ)) { return ''; } $view = Zikula_View::getInstance($this->name); $view->assign('active_review', !isset($args['active_review']) || isset($args['active']['active_review'])); return $view->fetch('search/options.tpl'); }
public function uiResponse(DisplayHook $hook, $content) { // Arrrr, we are forced to use Smarty -.- // We need to clone the instance, because it causes errors otherwise when multiple hooks areas are hooked. $view = clone \Zikula_View::getInstance('CmfcmfMediaModule'); $view->setCaching(\Zikula_View::CACHE_DISABLED); $view->assign('content', $content); $hook->setResponse(new \Zikula_Response_DisplayHook($this->getProvider(), $view, 'dummy.tpl')); }
public static function clearCache($template = '') { $view = Zikula_View::getInstance('Content'); if (!empty($template)) { $view->clear_cache($template); } else { $view->clear_cache(); } }
/** * Clear all compiled and cache directories. * * This function simply calls the theme and renderer modules to refresh the entire site. * * @return boolean true. */ public function clearallcompiledcaches() { Zikula_View_Theme::getInstance()->clear_all_cache(); Zikula_View_Theme::getInstance()->clear_compiled(); Zikula_View_Theme::getInstance()->clear_cssjscombinecache(); Zikula_View::getInstance()->clear_all_cache(); Zikula_View::getInstance()->clear_compiled(); return true; }
/** * Renders available search form options. */ public function options($args) { if (SecurityUtil::checkPermission('Content::', '::', ACCESS_READ)) { $render = Zikula_View::getInstance('Content'); $render->assign('active', isset($args['active']) && isset($args['active']['Content']) || !isset($args['active'])); return $render->fetch('search/options.tpl'); } return ''; }
/** * This function shows the content of the main MyProfile tab * * @return output */ public function tab($args) { // generate output $render = Zikula_View::getInstance('EZComments'); $render->assign('uid', (int) $args['uid']); $render->assign('viewer_uid', UserUtil::getVar('uid')); $render->assign('uname', UserUtil::getVar('uname', (int) $args['uid'])); $render->assign('settings', ModUtil::apiFunc('MyProfile', 'user', 'getSettings', array('uid' => $args['uid']))); return $render->fetch('ezcomments_myprofile_tab.tpl'); }
/** * OPtions * * This function will be called to display the search box. * * @return output the search field */ public function options($args) { if (SecurityUtil::checkPermission('EZComments::', '::', ACCESS_READ)) { // Create output object - this object will store all of our output so that // we can return it easily when required $render = Zikula_View::getInstance('EZComments'); $render->assign('active', !isset($args['active']) || isset($args['active']['EZComments'])); return $render->fetch('ezcomments_search_form.tpl'); } return ''; }
public function getContent() { ModUtil::dbInfoLoad('Content'); $dbtables = DBUtil::getTables(); $query = "SELECT " . $dbtables['content_page_column']['id'] . " , " . $dbtables['content_page_column']['title'] . ", " . $dbtables['content_page_column']['views'] . " \n \tFROM " . $dbtables['content_page'] . "\n\tWHERE " . $dbtables['content_page_column']['views'] . " >= 0 AND " . $dbtables['content_page_column']['active'] . " >= 0 ORDER BY " . $dbtables['content_page_column']['views'] . " DESC LIMIT 25"; $dbresult = DBUtil::executeSQL($query); $views = DBUtil::marshallObjects($dbresult); $view = Zikula_View::getInstance('Content'); $view->assign('views', $views); return $view->fetch('content_widget_top25.tpl'); }
/** * Search form component **/ function Admin_Messages_searchapi_options($args) { if (SecurityUtil::checkPermission('Admin_Messages:search:', '::', ACCESS_READ)) { // Create output object $view = Zikula_View::getInstance('Admin_Messages'); $view->assign(ModUtil::getVar('Admin_Messages')); $view->assign('active', isset($args['active']) && isset($args['active']['Admin_Messages']) || !isset($args['active'])); $view->assign('activeonly', isset($args['modvar']) && isset($args['modvar']['Admin_Messages']) && isset($args['modvar']['Admin_Messages']['activeonly']) || !isset($args['modvar'])); return $view->fetch('admin_messages_search_options.htm'); } return ''; }
public function ieTables() { // Security check will be done in catalegsgest() $this->throwForbiddenUnless(SecurityUtil::checkPermission('Llicencies::', '::', ACCESS_ADMIN)); $post_max_size = ini_get('post_max_size'); $view = Zikula_View::getInstance('Llicencies', false); $a1 = array('llicencies', 'llicencies_curs', 'llicencies_estats', 'llicencies_modalitat', 'llicencies_tema', 'llicencies_subtema', 'llicencies_tipus'); $t = array_combine($a1, $a1); $view->assign('tables', $t); $view->assign('post_max_size', $post_max_size); return $view->fetch('Llicencies_admin_ieTables.tpl'); }
/** * Render the search form component for Users. * * Parameters passed in the $args array: * ------------------------------------- * boolean 'active' Indicates that the Users module is an active part of the search(?). * * @param array $args All parameters passed to this function. * * @return string The rendered template for the Users search component. */ public function options($args) { $options = ''; if (SecurityUtil::checkPermission('IWforms::', '::', ACCESS_READ)) { // Create output object - this object will store all of our output so that // we can return it easily when required $renderer = Zikula_View::getInstance($this->name); $options = $renderer->assign('active', !isset($args['active']) || isset($args['active']['IWforms'])) ->fetch('IWforms_search_options.tpl'); } return $options; }
/** * Display the search form. * * @param array $args List of arguments. * * @return string template output */ public function options($args) { if (!SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_READ)) { return ''; } $view = Zikula_View::getInstance($this->name); $view->assign('active_posting', !isset($args['active_posting']) || isset($args['active']['active_posting'])); /*$view->assign('active_mediaHandler', (!isset($args['active_mediaHandler']) || isset($args['active']['active_mediaHandler']))); $view->assign('active_medium', (!isset($args['active_medium']) || isset($args['active']['active_medium']))); $view->assign('active_thumbSize', (!isset($args['active_thumbSize']) || isset($args['active']['active_thumbSize']))); */ return $view->fetch('search/options.tpl'); }
/** * return array of available plugins that have been * validated to be instanceof the base class * @param string $type Content|Layout * @return array */ public function getValidatedPlugins($type) { $plugins = array(); $baseclass = "Content_Abstract" . $type; foreach ($this->types[$type] as $type) { $view = Zikula_View::getInstance($type['module']); $instance = new $type['class']($view); if ($instance instanceof $baseclass) { $plugins[] = $instance; } } usort($plugins, array('Content_Types', 'pluginSort')); return $plugins; }
/** * Clear cache for given item. Can be called from other modules to clear an item cache. * * @param $args['ot'] the treated object type * @param $args['item'] the actual object */ public function clearItemCache(array $args = array()) { if (!isset($args['ot']) || !isset($args['item'])) { return; } $objectType = $args['ot']; $item = $args['item']; $controllerHelper = new Reviews_Util_Controller($this->serviceManager); $utilArgs = array('api' => 'cache', 'action' => 'clearItemCache'); if (!in_array($objectType, $controllerHelper->getObjectTypes('controllerAction', $utilArgs))) { return; } if ($item && !is_array($item) && !is_object($item)) { $item = ModUtil::apiFunc($this->name, 'selection', 'getEntity', array('ot' => $objectType, 'id' => $item, 'useJoins' => false, 'slimMode' => true)); } if (!$item) { return; } // create full identifier (considering composite keys) $idFields = ModUtil::apiFunc($this->name, 'selection', 'getIdFields', array('ot' => $objectType)); $instanceId = ''; foreach ($idFields as $idField) { if (!empty($instanceId)) { $instanceId .= '_'; } $instanceId .= $item[$idField]; } // Clear View_cache $cacheIds = array(); $cacheIds[] = 'main'; $cacheIds[] = 'view'; $cacheIds[] = $instanceId; $view = Zikula_View::getInstance('Reviews'); foreach ($cacheIds as $cacheId) { $view->clear_cache(null, $cacheId); } // Clear Theme_cache $cacheIds = array(); $cacheIds[] = 'homepage'; // for homepage (can be assigned in the Settings module) $cacheIds[] = 'Reviews/user/main'; // main function $cacheIds[] = 'Reviews/user/view/' . $objectType; // view function (list views) $cacheIds[] = 'Reviews/user/display/' . $objectType . '|' . $instanceId; // display function (detail views) $theme = Zikula_View_Theme::getInstance(); $theme->clear_cacheid_allthemes($cacheIds); }
/** * Smarty function build module header in user content page. * * {moduleheader} * * Available parameters: * modname Module name to display header for (optional, defaults to current module) * type Type for module links (defaults to 'user') * title Title to display in header (optional, defaults to module name) * titlelink Link to attach to title (optional, defaults to none) * setpagetitle If set to true, {pagesetvar} is used to set page title * insertstatusmsg If set to true, {insert name='getstatusmsg'} is put in front of template * menufirst If set to true, menu is first, then title * putimage If set to true, module image is also displayed next to title * * @param array $params All attributes passed to this function from the template. * @param Zikula_View $view Reference to the Zikula_View object. * * @return string A formatted string containing navigation for the module admin panel. */ function smarty_function_moduleheader($params, $view) { if (!isset($params['modname']) || !ModUtil::available($params['modname'])) { $params['modname'] = ModUtil::getName(); } if (empty($params['modname'])) { return false; } $type = isset($params['type']) ? $params['type'] : 'user'; $assign = isset($params['assign']) ? $params['assign'] : null; $menufirst = isset($params['menufirst']) ? $params['menufirst'] : false; $putimage = isset($params['putimage']) ? $params['putimage'] : false; $setpagetitle = isset($params['setpagetitle']) ? $params['setpagetitle'] : false; $insertstatusmsg = isset($params['insertstatusmsg']) ? $params['insertstatusmsg'] : false; $cutlenght = isset($params['cutlenght']) ? $params['cutlenght'] : 20; if ($putimage) { $image = isset($params['image']) ? $params['image'] : ModUtil::getModuleImagePath($params['modname']); } else { $image = ''; } if (!isset($params['title'])) { $modinfo = ModUtil::getInfoFromName($params['modname']); if (isset($modinfo['displayname'])) { $params['title'] = $modinfo['displayname']; } else { $params['title'] = ModUtil::getName(); } } $titlelink = isset($params['titlelink']) ? $params['titlelink'] : false; $renderer = Zikula_View::getInstance('Theme'); $renderer->setCaching(Zikula_View::CACHE_DISABLED); $renderer->assign('userthemename', UserUtil::getTheme()); $renderer->assign('modname', $params['modname']); $renderer->assign('type', $params['type']); $renderer->assign('title', $params['title']); $renderer->assign('titlelink', $titlelink); $renderer->assign('truncated', mb_strlen($params['title']) > $cutlenght); $renderer->assign('titletruncated', mb_substr($params['title'], 0, $cutlenght) . '...'); $renderer->assign('setpagetitle', $setpagetitle); $renderer->assign('insertstatusmsg', $insertstatusmsg); $renderer->assign('menufirst', $menufirst); $renderer->assign('image', $image); if ($assign) { $view->assign($assign, $renderer->fetch('moduleheader.tpl')); } else { return $renderer->fetch('moduleheader.tpl'); } }
/** * return array of available plugins that have been * validated to be instanceof the base class * @param string $type Content|Layout * @return array */ public function getValidatedPlugins($type) { $plugins = array(); $baseclass = "Content_Abstract" . $type; foreach ($this->types[$type] as $type) { $view = Zikula_View::getInstance($type['module']); $instance = new $type['class']($view); if ($instance instanceof $baseclass) { $plugins[] = $instance; } } // @ added to surpress errors, since some PHP versions report an exception // that the comparison method changes the array, which is not the case. @usort($plugins, array('Content_Types', 'pluginSort')); return $plugins; }
/** * Event handler here. * * @param Zikula_Event $event Event handler. * * @return void */ public function handler(Zikula_Event $event) { // check if this is for this handler $subject = $event->getSubject(); if (!($event['method'] == 'extensions' && $subject instanceof Users_Controller_Admin)) { return; } if (!SecurityUtil::checkPermission('Users::', '::', ACCESS_ADMIN)) { return LogUtil::registerPermissionError(); } // Zikula Modules and Themes versions $view = Zikula_View::getInstance('Users'); $view->assign('mods', ModuleUtil::getModules()); $view->assign('themes', ThemeUtil::getAllThemes()); $event->setData($view->fetch('users_admin_extensions.tpl')); $event->stop(); }