/** * Toggleblock. * * This function toggles active/inactive. * * @param bid int id of block to toggle. * * @return mixed true or Ajax error */ public function toggleblock() { $this->checkAjaxToken(); $this->throwForbiddenUnless(SecurityUtil::checkPermission('Blocks::', '::', ACCESS_ADMIN)); $bid = $this->request->request->get('bid', -1); if ($bid == -1) { throw new Zikula_Exception_Fatal($this->__('No block ID passed.')); } // read the block information $blockinfo = BlockUtil::getBlockInfo($bid); if ($blockinfo == false) { throw new Zikula_Exception_Fatal($this->__f('Error! Could not retrieve block information for block ID %s.', DataUtil::formatForDisplay($bid))); } if ($blockinfo['active'] == 1) { ModUtil::apiFunc('Blocks', 'admin', 'deactivate', array('bid' => $bid)); } else { ModUtil::apiFunc('Blocks', 'admin', 'activate', array('bid' => $bid)); } return new Zikula_Response_Ajax(array('bid' => $bid)); }
/** * Handle module install event "installer.module.installed". * Receives $modinfo as $args * * @param Zikula_Event $event * * @return void */ public static function moduleInstall(Zikula_Event $event) { $mod = $event['name']; // determine search capability if (ModUtil::apiFunc($mod, 'search', 'info')) { // get all search blocks $blocks = BlockUtil::getBlocksInfo(); foreach ($blocks as $block) { $block = $block->toArray(); if ($block['bkey'] != 'Search') { continue; } $content = BlockUtil::varsFromContent($block['content']); if (!isset($content['active'])) { $content['active'] = array(); } $content['active'][$mod] = 1; $block['content'] = BlockUtil::varsToContent($content); ModUtil::apiFunc('Blocks', 'admin', 'update', $block); } } }
/** * Renders and displays a single Zikula block by blockinfo array or block id. * * Available attributes: * - module (string) The internal name of the module that defines the block. * - blockname (string) The internal name of the block. * - block (int|array) Either the integer block id (bid) of the block, or * an array containing the blockinfo for the block. * - position (string) The position of the block. * - assign (string) If set, the results are assigned to the corresponding * template variable instead of being returned to the template (optional) * * @param array $params All attributes passed to this function from the template. * @param Zikula_View $view Reference to the {@link Zikula_View} object. * * @return string The rendered output of the specified block. */ function smarty_function_blockshow($params, Zikula_View $view) { $module = isset($params['module']) ? $params['module'] : null; $blockname = isset($params['blockname']) ? $params['blockname'] : null; $block = isset($params['block']) ? $params['block'] : null; $position = isset($params['position']) ? $params['position'] : null; $assign = isset($params['assign']) ? $params['assign'] : null; if (!$module) { $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('blockshow', 'module'))); return; } if (!$blockname) { $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('blockshow', 'blockname'))); return; } if (!$block) { $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('blockshow', 'id/info'))); return; } if (!$position) { $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('blockshow', 'position'))); return; } if (!is_array($block)) { $block = BlockUtil::getBlockInfo($block); } $block['position'] = $position; $output = BlockUtil::show($module, $blockname, $block); if ($assign) { $view->assign($assign, $output); } else { return $output; } }
/** * Display block. * * @param array $blockinfo Blockinfo structure. * * @return output Rendered block. */ public function display($blockinfo) { if (!SecurityUtil::checkPermission('PendingContent::', "{$blockinfo['title']}::", ACCESS_OVERVIEW)) { return; } // trigger event $event = new Zikula_Event('get.pending_content', new Zikula_Collection_Container('pending_content')); $pendingCollection = EventUtil::getManager()->notify($event)->getSubject(); $content = array(); // process results foreach ($pendingCollection as $collection) { $module = $collection->getName(); foreach ($collection as $item) { $link = ModUtil::url($module, $item->getController(), $item->getMethod(), $item->getArgs()); $content[] = array('description' => $item->getDescription(), 'link' => $link, 'number' => $item->getNumber()); } } if (!empty($content)) { $this->view->assign('content', $content); $blockinfo['content'] = $this->view->fetch('blocks_block_pendingcontent.tpl'); } else { $blockinfo['content'] = ''; } return BlockUtil::themeBlock($blockinfo); }
/** * Obtain the value of one block variable or all block variables for a specified block. * * Note: If the name of the block variable is not set, then the assign parameter * must be set since an array of block variables will be returned. * * Available attributes: * - bid (numeric) The block id * - name (string) The name of the block variable to get, otherwise the * entire block array is assigned is returned. * (required, if the assign attribute is not specified, * otherwise, optional) * - assign (string) The name of the template variable to which the value * is assigned, instead of being output to the template. * (optional if the name attribute is set, otherwise * required) * * @param array $params All attributes passed to this function from the template. * @param Zikula_View $view Reference to the {@link Zikula_View} object. * * @return mixed the value of the block variable specified by the name attribute, * or an array containing the full block information. */ function smarty_function_blockgetinfo($params, Zikula_View $view) { $bid = isset($params['bid']) ? (int) $params['bid'] : 0; $name = isset($params['name']) ? $params['name'] : null; $assign = isset($params['assign']) ? $params['assign'] : null; if (!$bid) { $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('blockgetinfo', 'bid'))); } // get the block info array $blockinfo = BlockUtil::getBlockInfo($bid); if ($name) { if ($assign) { $view->assign($assign, $blockinfo[$name]); } else { return $blockinfo[$name]; } } else { // handle the full blockinfo array if ($assign) { $view->assign($assign, $blockinfo); } else { $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified to get the full block information.', array('pnblockgetinfo', 'assign'))); } } return; }
/** * display block * * @param array $blockinfo a blockinfo structure * @return output the rendered bock */ public function display($blockinfo) { if (!SecurityUtil::checkPermission('HTMLblock::', "{$blockinfo['title']}::", ACCESS_OVERVIEW)) { return; } return BlockUtil::themeBlock($blockinfo); }
/** * Display block. * * @param array $blockInfo A blockinfo structure. * * @return string The rendered block. */ public function display($blockInfo) { $renderedOutput = ''; if (SecurityUtil::checkPermission('Accountlinks::', $blockInfo['title']."::", ACCESS_READ)) { // Get variables from content block $vars = BlockUtil::varsFromContent($blockInfo['content']); // Call the modules API to get the items if (ModUtil::available($this->name)) { $accountlinks = ModUtil::apiFunc($this->name, 'user', 'accountLinks'); // Check for no items returned if (!empty($accountlinks)) { $this->view->setCaching(Zikula_View::CACHE_DISABLED) ->assign('accountlinks', $accountlinks); // Populate block info and pass to theme $blockInfo['content'] = $this->view->fetch('users_block_accountlinks.tpl'); $renderedOutput = BlockUtil::themeBlock($blockInfo); } } } return $renderedOutput; }
public function showBlock($block, $blockname, $module) { if (!is_array($block)) { $block = \BlockUtil::getBlockInfo($block); } return \BlockUtil::show($module, $blockname, $block); }
function update($blockinfo) { $vars = BlockUtil::varsFromContent($blockinfo['content']); $vars['page'] = FormUtil::getPassedValue('page', 0, 'POST'); $blockinfo['content'] = BlockUtil::varsToContent($vars); return $blockinfo; }
/** * Display the block. * * @param array $blockinfo the blockinfo structure * * @return string output of the rendered block */ public function display($blockinfo) { // only show block content if the user has the required permissions if (!SecurityUtil::checkPermission('Reviews:ModerationBlock:', "{$blockinfo['title']}::", ACCESS_OVERVIEW)) { return false; } // check if the module is available at all if (!ModUtil::available('Reviews')) { return false; } if (!UserUtil::isLoggedIn()) { return false; } ModUtil::initOOModule('Reviews'); $this->view->setCaching(Zikula_View::CACHE_DISABLED); $template = $this->getDisplayTemplate($vars); $workflowHelper = new Reviews_Util_Workflow($this->serviceManager); $amounts = $workflowHelper->collectAmountOfModerationItems(); // assign block vars and fetched data $this->view->assign('moderationObjects', $amounts); // set a block title if (empty($blockinfo['title'])) { $blockinfo['title'] = $this->__('Moderation'); } $blockinfo['content'] = $this->view->fetch($template); // return the block to the theme return BlockUtil::themeBlock($blockinfo); }
/** * display block * * @param array $blockinfo a blockinfo structure * @return output the rendered bock */ public function display($blockinfo) { if (!SecurityUtil::checkPermission('Textblock::', "{$blockinfo['title']}::", ACCESS_OVERVIEW)) { return; } $blockinfo['content'] = nl2br($blockinfo['content']); return BlockUtil::themeBlock($blockinfo); }
public function update($blockinfo) { $vars = BlockUtil::varsFromContent($blockinfo['content']); $vars['root'] = FormUtil::getPassedValue('root', 0, 'POST'); $vars['usecaching'] = (bool) FormUtil::getPassedValue('usecaching', false, 'POST'); $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('block/menu.tpl'); return $blockinfo; }
function startEditing() { $blocksInfo = BlockUtil::getBlocksInfo(); $blockoptions = array(); // add first empty choice $blockoptions[] = array('text' => __('- Make a choice -'), 'value' => '0'); foreach ($blocksInfo as $block) { $blockoptions[] = array('text' => $block['bid'] . ' - ' . $block['title'] . ' (' . ($block['active']?__('Active'):__('InActive')) . ')', 'value' => $block['bid']); } $this->view->assign('blockoptions', $blockoptions); }
/** * Display block. * * @param array $blockInfo A blockinfo structure. * * @return string|void The rendered block. */ public function display($blockInfo) { if (!SecurityUtil::checkPermission('Userblock::', $blockInfo['title']."::", ACCESS_READ)) { return; } if (UserUtil::isLoggedIn() && UserUtil::getVar('ublockon') == 1) { if (!isset($blockInfo['title']) || empty($blockInfo['title'])) { $blockInfo['title'] = $this->__f('Custom block content for %s', UserUtil::getVar('name')); } $blockInfo['content'] = nl2br(UserUtil::getVar('ublock')); return BlockUtil::themeBlock($blockInfo); } return; }
/** * display block */ public function display($blockinfo) { // Security check if (!SecurityUtil::checkPermission('Admin:adminnavblock', "{$blockinfo['title']}::{$blockinfo['bid']}", ACCESS_ADMIN)) { return; } // Get variables from content block $vars = BlockUtil::varsFromContent($blockinfo['content']); // Call the modules API to get the items if (!ModUtil::available('Admin')) { return; } $items = ModUtil::apiFunc('Admin', 'admin', 'getall'); // Check for no items returned if (empty($items)) { return; } // get admin capable modules $adminmodules = ModUtil::getAdminMods(); $adminmodulescount = count($adminmodules); // Display each item, permissions permitting $admincategories = array(); foreach ($items as $item) { if (SecurityUtil::checkPermission('Admin::', "{$item['catname']}::{$item['cid']}", ACCESS_READ)) { $adminlinks = array(); foreach ($adminmodules as $adminmodule) { // Get all modules in the category $catid = ModUtil::apiFunc('Admin', 'admin', 'getmodcategory', array('mid' => ModUtil::getIdFromName($adminmodule['name']))); if ($catid == $item['cid'] || $catid == false && $item['cid'] == $this->getVar('defaultcategory')) { $modinfo = ModUtil::getInfoFromName($adminmodule['name']); $menutexturl = ModUtil::url($modinfo['name'], 'admin'); $menutexttitle = $modinfo['displayname']; $adminlinks[] = array('menutexturl' => $menutexturl, 'menutexttitle' => $menutexttitle); } } $admincategories[] = array('url' => ModUtil::url('Admin', 'admin', 'adminpanel', array('cid' => $item['cid'])), 'title' => DataUtil::formatForDisplay($item['catname']), 'modules' => $adminlinks); } } $this->view->assign('admincategories', $admincategories); // Populate block info and pass to theme $blockinfo['content'] = $this->view->fetch('admin_block_adminnav.tpl'); return BlockUtil::themeBlock($blockinfo); }
/** * Show the month calendar into a bloc * @autor: Albert Pérez Monfort * @autor: Toni Ginard Lladó * param: The month and the year to show * return: The calendar content */ public function display($blockinfo) { // Security check if (!SecurityUtil::checkPermission("IWusers:welcomeblock:", $blockinfo['title'] . "::", ACCESS_READ)) { return; } $baseURL = System::getBaseUrl(); $baseURL .= 'index.php'; if ('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] != $baseURL) { return; } // Check if the module is available if (!ModUtil::available('IWusers')) { return; } $user = (UserUtil::isLoggedIn()) ? UserUtil::getVar('uid') : '-1'; // Only for loggedin users if ($user == '-1') { return; } $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); $userName = ModUtil::func('IWmain', 'user', 'getUserInfo', array('sv' => $sv, 'uid' => $user, 'info' => 'n')); $values = explode('---', $blockinfo['url']); $hello = (!empty($values[0])) ? $values[0] : $this->__('Hi'); $welcome = (!empty($values[0])) ? $values[1] : $this->__('welcome to the intranet'); $date = (isset($values[2])) ? $values[2] : ''; $s = $this->view->assign('userName', $userName) ->assign('hello', $hello) ->assign('welcome', $welcome) ->assign('date', $date) ->assign('dateText', date('d/m/Y', time())) ->assign('timeText', date('H.i', time())) ->fetch('IWusers_block_welcome.htm'); // Populate block info and pass to theme $blockinfo['content'] = $s; return BlockUtil::themesideblock($blockinfo); }
/** * Renders and displays all active blocks assigned to the specified position. * * Available attributes: * - name (string) name of the block position to render and display; to * support legacy templates, the strings 'l', 'r', and * 'c' will be translated to 'left', 'right' and 'center' * - implode (bool|int) if set, the indiviual blocks in the position will be * 'imploded' to a single string (optional, default == true) * - assign (string) if set, the rendered output will be assigned to this * variable instead of being returned to the template (optional) * * Example: * * <samp>{blockposition name='left'}</samp> * * @param array $params All attributes passed to this function from the template. * @param Zikula_View $view Reference to the {@link Zikula_View} object. * * @return string The rendered ouput of all of the blocks assigned to this position. */ function smarty_function_blockposition($params, Zikula_View $view) { // fix the core positions for a better name if ($params['name'] == 'l') { $params['name'] = 'left'; } if ($params['name'] == 'r') { $params['name'] = 'right'; } if ($params['name'] == 'c') { $params['name'] = 'center'; } if (!isset($params['name'])) { $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('blockposition', 'name'))); return false; } $implode = isset($params['implode']) && isset($params['assign']) ? (bool) $params['implode'] : true; $return = BlockUtil::displayPosition($params['name'], false, $implode); if (isset($params['assign'])) { $view->assign($params['assign'], $return); } else { return $return; } }
/** * Gets user news * * @return el bloc de novetats */ public function display($blockinfo) { // Security check if (!SecurityUtil::checkPermission('Cataleg::', '::', ACCESS_READ)) return; // Check if the module is available if (!ModUtil::available('Cataleg')) return; $renderedOutput = ''; // Get the view object $view = Zikula_View::getInstance('Cataleg', false); $novetats = ModUtil::apiFunc($this->name, 'user', 'getNovetats'); if ($novetats['novetats'] || $novetats['canvis']) { $view->assign('novetats', $novetats); $s = $view->fetch('block/Cataleg_block_Novetats.tpl'); $blockinfo['content'] = $s; $renderedOutput = BlockUtil::themesideblock($blockinfo); } return $renderedOutput; }
/** * 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 user news * * @author Albert Pérez Monfort (aperezm@xtec.cat) * @return The user news block */ public function display($row) { // Security check if (!SecurityUtil::checkPermission('IWmain:newsBlock:', $row['title'] . "::", ACCESS_READ) || !UserUtil::isLoggedIn()) { return false; } if (ModUtil::getVar('IWmain', 'URLBase') != System::getBaseUrl()) { ModUtil::setVar('IWmain', 'URLBase', System::getBaseUrl()); } $uid = UserUtil::getVar('uid'); //get the headlines 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' => 'news', 'module' => 'IWmain_block_news', 'uid' => $uid, 'sv' => $sv)); if ($exists) { $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); $have_news = ModUtil::func('IWmain', 'user', 'userGetVar', array('uid' => $uid, 'name' => 'have_news', 'module' => 'IWmain_block_news', 'sv' => $sv)); if ($have_news != '0') { ModUtil::func('IWmain', 'user', 'news', array('where' => $have_news)); $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); ModUtil::func('IWmain', 'user', 'userSetVar', array('uid' => $uid, 'name' => 'have_news', 'module' => 'IWmain_block_news', 'sv' => $sv, 'value' => '0')); } $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); $have_flags = ModUtil::func('IWmain', 'user', 'userGetVar', array('uid' => UserUtil::getVar('uid'), 'name' => 'have_flags', 'module' => 'IWmain_block_flagged', 'sv' => $sv)); if ($have_flags != '0') { ModUtil::func('IWmain', 'user', 'flagged', array('where' => $have_flags, 'chars' => 15)); $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); ModUtil::func('IWmain', 'user', 'userSetVar', array('uid' => UserUtil::getVar('uid'), 'name' => 'have_flags', 'module' => 'IWmain_block_flagged', 'sv' => $sv, 'value' => '0')); } } else { ModUtil::func('IWmain', 'user', 'news'); } //get the flagged items $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); if (!$exists = ModUtil::apiFunc('IWmain', 'user', 'userVarExists', array('name' => 'flagged', 'module' => 'IWmain_block_flagged', 'uid' => $uid, 'sv' => $sv))) { ModUtil::func('IWmain', 'user', 'flagged', array('where' => '', 'chars' => 15)); } $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); $news = ModUtil::func('IWmain', 'user', 'userGetVar', array('uid' => $uid, 'name' => 'news', 'module' => 'IWmain_block_news', 'sv' => $sv, 'nult' => true)); $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); $flags = ModUtil::func('IWmain', 'user', 'userGetVar', array('uid' => UserUtil::getVar('uid'), 'name' => 'flagged', 'module' => 'IWmain_block_flagged', 'sv' => $sv, 'nult' => true)); $this->view->assign('news', $news) ->assign('flags', $flags); $s = $this->view->fetch('IWmain_block_IWnews.tpl'); $row['content'] = $s; return BlockUtil::themesideblock($row); }
public function display($blockinfo) { // Security check if (!SecurityUtil::checkPermission('IWagendas:nextblock:', $blockinfo['title'] . "::", ACCESS_READ)) return; // Check if the module is available if (!ModUtil::available('IWagendas')) return; $user = (UserUtil::isLoggedIn()) ? UserUtil::getVar('uid') : '-1'; //get the headlines 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' => 'next', 'module' => 'IWagendas', 'uid' => $user, 'sv' => $sv)); //$exists = false; if ($exists) { $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); $s = ModUtil::func('IWmain', 'user', 'userGetVar', array('uid' => $user, 'name' => 'next', 'module' => 'IWagendas', 'sv' => $sv, 'nult' => true)); $blockinfo['content'] = $s; return BlockUtil::themesideblock($blockinfo); } // Get the view object $view = Zikula_View::getInstance('IWagendas', false); // Get the number of days in which the future events will be shown $days = $blockinfo['url']; // Get the annotations in the following days $texts = ModUtil::apiFunc('IWagendas', 'user', 'getEvents', array('inici' => time(), 'final' => time() + $days * 24 * 60 * 60)); foreach ($texts as $text) { $datafield = str_replace("\r", '', str_replace('\'', '´', $text['c1'])); // replace any newlines that aren't preceded by a > with a <br /> $datafield = preg_replace('/(?<!>)\n/', "<br />", $datafield); $title = ($text['tasca']) ? $this->__('Task') . ' - ' . $text['nivell'] : ($text['totdia'] == 1) ? $this->__('All day') : date('H:i', $text['data']); $date = date('d/m', $text['data']); $events[] = array('date' => $date, 'title' => $title, 'deleted' => $text['deleted'], 'modified' => $text['modified'], 'datafield' => $datafield); } if (count($texts) == 0) { $events[] = array('date' => '', 'title' => '', 'deleted' => 0, 'modified' => 0, 'datafield' => $this->__('There are no events in the agenda for the next ') . ' ' . $days . ' ' . $this->__(' days'), ); } $view->assign('events', $events); $view->assign('days', $days); $s = $view->fetch('IWagendas_block_next.htm'); //Copy the block information into user vars $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue'); ModUtil::func('IWmain', 'user', 'userSetVar', array('uid' => $user, 'name' => 'next', 'module' => 'IWagendas', 'sv' => $sv, 'value' => $s, 'lifetime' => '700')); $blockinfo['content'] = $s; return BlockUtil::themesideblock($blockinfo); }
/** * update block settings * * @param array $blockinfo a blockinfo structure * @return $blockinfo the modified blockinfo structure */ public function update($blockinfo) { // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // alter the corresponding variable $vars['mod'] = (string) FormUtil::getPassedValue('mod', '', 'POST'); $vars['numentries'] = (int) FormUtil::getPassedValue('numentries', 5, 'POST'); $vars['numdays'] = (int) FormUtil::getPassedValue('numdays', 0, 'POST'); $vars['showusername'] = (bool) FormUtil::getPassedValue('showusername', false, 'POST'); $vars['linkusername'] = (bool) FormUtil::getPassedValue('linkusername', false, 'POST'); $vars['showdate'] = (bool) FormUtil::getPassedValue('showdate', false, 'POST'); $vars['showpending'] = (bool) FormUtil::getPassedValue('showpending', false, 'POST'); // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('ezcomments_block_ezcomments.tpl'); return $blockinfo; }
/** * update block settings * * @param array $blockinfo A blockinfo structure. * * @return array The modified blockinfo structure. */ public function update($blockinfo) { // get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // alter the corresponding variable $vars['pid'] = (int)FormUtil::getPassedValue('pid', null, 'POST'); // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('block/pageslist.tpl'); return $blockinfo; }
/** * update block settings * * @param array $blockinfo a blockinfo structure * @return $blockinfo the modified blockinfo structure */ public function update($blockinfo) { $vars['displaymodules'] = FormUtil::getPassedValue('displaymodules'); $vars['stylesheet'] = FormUtil::getPassedValue('stylesheet'); $vars['template'] = FormUtil::getPassedValue('template'); $vars['blocktitles'] = FormUtil::getPassedValue('blocktitles'); // Defaults if (empty($vars['displaymodules'])) { $vars['displaymodules'] = 0; } if (empty($vars['template'])) { $vars['template'] = 'blocks_block_extmenu.tpl'; } if (empty($vars['stylesheet'])) { $vars['stylesheet'] = 'extmenu.css'; } // User links $content = array(); $vars['links'] = FormUtil::getPassedValue('links'); $vars['blockversion'] = 1; // Save links hierarchy $linksorder = FormUtil::getPassedValue('linksorder'); $linksorder = json_decode($linksorder, true); if (is_array($linksorder) && !empty($linksorder)) { foreach ((array) $vars['links'] as $lang => $langlinks) { foreach ($langlinks as $linkid => $link) { $vars['links'][$lang][$linkid]['parentid'] = $linksorder[$linkid]['parentid']; $vars['links'][$lang][$linkid]['haschildren'] = $linksorder[$linkid]['haschildren']; } } } $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache(null, $blockinfo['bkey'] . '/bid' . $blockinfo['bid']); // and clear the theme cache Zikula_View_Theme::getInstance()->clear_cache(); return $blockinfo; }
/** * Get all security permissions schemas. * * @return array array if permission schema values. */ public function getallschemas() { // Security check if (!SecurityUtil::checkPermission('Permissions::', '::', ACCESS_ADMIN)) { return LogUtil::registerPermissionError(); } $schemas = SecurityUtil::getSchemas(); BlockUtil::loadAll(); $modinfos = ModUtil::getAllMods(); foreach ($modinfos as $modinfo) { if (!empty($modinfo['securityschema'])) { $schemas = array_merge($schemas, $modinfo['securityschema']); } } uksort($schemas, 'strnatcasecmp'); SecurityUtil::setSchemas($schemas); return $schemas; }
/** * update block settings * * @param array $blockinfo a blockinfo structure * @return $blockinfo the modified blockinfo structure */ public function update($blockinfo) { // list of vars that don't need to be saved $search_reserved_vars = array('authid', 'csrftoken', 'bid', 'title', 'positions', 'language', 'submit', 'refresh', 'filter', 'type', 'functions', 'customargs'); // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); foreach ($_POST as $key => $value) { if (in_array($key, $search_reserved_vars)) { continue; } $vars[$key] = $value; } // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('search_block_search.tpl'); // and clear the theme cache Zikula_View_Theme::getInstance()->clear_cache(); return($blockinfo); }
/** * update block settings * * @param array $blockinfo a blockinfo structure * @return $blockinfo the modified blockinfo structure */ public function update($blockinfo) { // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // alter the corresponding variable $vars['filo'] = FormUtil::getPassedValue('filo'); $vars['typo'] = FormUtil::getPassedValue('typo'); // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); return $blockinfo; }
public function update($blockinfo) { // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // alter the corresponding variable $vars['format'] = FormUtil::getPassedValue('format', 1, 'POST'); // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('theme_block_themeswitcher.tpl'); // and clear the theme cache Zikula_View_Theme::getInstance()->clear_cache(); return $blockinfo; }
public function deleteBlock($bid) { // Ensure that $bid is 1 or higher. if (!is_numeric($bid) || $bid < 1) { $this->setError(__('Block ID Invalid')); return false; } // Ensure block exists. if (!BlockUtil::getBlockInfo($bid)) { $this->setError(__('No Such Block Exists')); return false; } // Delete block placements for this block. if (!DBUtil::deleteObjectByID('block_placements', $bid, 'bid')) { $this->setError(__('Block Placements Not Removed')); return false; } // Delete the block itself. if (!DBUtil::deleteObjectByID('blocks', $bid, 'bid')) { $this->setError(__('Block Not Deleted')); return false; } // Let other modules know we have deleted an item. ModUtil::callHooks('item', 'delete', $bid, array('module' => 'Blocks')); // Success. return true; }
/** * update block settings */ public function update($blockinfo) { // get old variable values from database $vars = BlockUtil::varsFromContent($blockinfo['content']); // get new variable values from form $vars['block_template'] = FormUtil::getPassedValue('block_template', 'marquee.tpl', 'POST'); $vars['block_title'] = FormUtil::getPassedValue('block_title', array(), 'POST'); $vars['block_wrap'] = FormUtil::getPassedValue('block_wrap', true, 'POST'); $vars['marquee_content'] = FormUtil::getPassedValue('marquee_content', array(), 'POST'); $vars['marquee_content_editor'] = FormUtil::getPassedValue('marquee_content_editor', false, 'POST'); $vars['marquee_duration'] = FormUtil::getPassedValue('marquee_duration', 15000, 'POST'); $vars['marquee_gap'] = FormUtil::getPassedValue('marquee_gap', 200, 'POST'); $vars['marquee_delayBeforeStart'] = FormUtil::getPassedValue('marquee_delayBeforeStart', 0, 'POST'); $vars['marquee_direction'] = FormUtil::getPassedValue('marquee_direction', 'left', 'POST'); $vars['marquee_duplicated'] = FormUtil::getPassedValue('marquee_duplicated', true, 'POST'); $vars['marquee_pauseOnHover'] = FormUtil::getPassedValue('marquee_pauseOnHover', true, 'POST'); $vars['marquee_pauseOnCycle'] = FormUtil::getPassedValue('marquee_pauseOnCycle', false, 'POST'); // write new values $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('blocks/marquee.tpl'); return $blockinfo; }