/** * 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); } } }
function update($blockinfo) { $vars = BlockUtil::varsFromContent($blockinfo['content']); $vars['page'] = FormUtil::getPassedValue('page', 0, 'POST'); $blockinfo['content'] = BlockUtil::varsToContent($vars); return $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; }
/** * 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[name]::$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['name']), '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); }
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; }
/** * modify block settings * * @param array $blockinfo a blockinfo structure * @return output the bock form */ public function modify($blockinfo) { // Get our block vars $vars = BlockUtil::varsFromContent($blockinfo['content']); $this->view->setCaching(Zikula_View::CACHE_DISABLED); // assign our block vars $this->view->assign($vars); // return the output return $this->view->fetch('blocks_block_xslt_modify.tpl'); }
/** * Update block settings * * @param array $blockInfo blockinfo array * * @return array $blockinfo */ public function update($blockInfo) { $vars = BlockUtil::varsFromContent($blockInfo['content']); // write back the new contents $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; }
/** * Convert data of selected menu to menutree style * Used to import menus */ private function _import_menu($bid) { if ((!isset($bid)) || (isset($bid) && !is_numeric($bid))) { return; } $menu = BlockUtil::getBlockInfo($bid); $menuVars = BlockUtil::varsFromContent($menu['content']); $userlanguage = ZLanguage::getLanguageCode(); $menuType = strtolower($menu['bkey']); switch ($menuType) { case 'menutree': $data = isset($menuVars['menutree_content']) ? $menuVars['menutree_content'] : array(); break; case 'menu': if (isset($menuVars['content']) && !empty($menuVars['content'])) { $reflang = $userlanguage; $pid = 1; $data = array(); $contentlines = explode('LINESPLIT', $menuVars['content']); foreach ($contentlines as $lineno => $contentline) { list($href, $name, $title) = explode('|', $contentline); if (!empty($name)) { $className = ''; $parent = 0; $state = 1; $lang = $reflang; $id = $pid; $data[$lineno][$reflang] = compact('href','name','title','className','parent','state','lang','lineno','id'); $pid++; } } $langs = (array)$reflang; $lineno++; } break; case 'extmenu': if (isset($menuVars['links']) && !empty($menuVars['links'])) { $langs = array_keys($menuVars['links']); $data = array(); foreach ($langs as $lang) { foreach ($menuVars['links'][$lang] as $id => $link) { $data[$id][$lang] = array( 'id' => $id + 1, 'name' => isset($link['name']) && !empty($link['name']) ? $link['name'] : $this->__('no name'), 'href' => isset($link['url']) ? $link['url'] : '', 'title' => isset($link['title']) ? $link['title'] : '', 'className' => '', 'state' => isset($link['active']) && $link['active'] && $link['name'] ? 1 : 0, 'lang' => $lang, 'lineno' => $id, 'parent' => 0 ); } } ksort($data); $pid = $id + 2; $lineno = count($data); } break; } if (!empty($menuVars['displaymodules'])) { $mods = ModUtil::getUserMods(); if (is_array($mods) && count($mods)>0) { foreach ($mods as $mod) { $tmp = array('name' => $mod['displayname'], 'href' => DataUtil::formatForDisplay(ModUtil::url($mod['name'], 'user', 'main')), 'title' => $mod['description']); foreach ($langs as $lang) { $tmp = array_merge($tmp, array('className' => '', 'parent' => 0, 'lang' => $lang, 'state' => 1, 'lineno' => $lineno, 'id' => $pid)); $tmparray[$lang] = $tmp; } $data[] = $tmparray; $pid++; $lineno++; } } } return $data; }
/** * 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['lengthmax'] = (int)$this->request->getPost()->get('lengthmax', null); // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('profile_block_membersonline.tpl'); 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']); $vars['objectType'] = $this->request->getPost()->filter('objecttype', 'category', FILTER_SANITIZE_STRING); $vars['sorting'] = $this->request->getPost()->filter('sorting', 'default', FILTER_SANITIZE_STRING); $vars['amount'] = (int) $this->request->getPost()->filter('amount', 5, FILTER_VALIDATE_INT); $vars['template'] = $this->request->getPost()->get('template', ''); $vars['filter'] = $this->request->getPost()->get('filter', ''); if (!in_array($vars['objectType'], MUBoard_Util_Controller::getObjectTypes('block'))) { $vars['objectType'] = MUBoard_Util_Controller::getDefaultObjectType('block'); } // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('block/itemlist_display.tpl'); $this->view->clear_cache('block/itemlist_' . ucwords($vars['objectType']) . '_display.tpl'); $this->view->clear_cache('block/itemlist_display_description.tpl'); $this->view->clear_cache('block/itemlist_' . ucwords($vars['objectType']) . '_display_description.tpl'); return $blockinfo; }
/** * display block * * @author Albert P�rez Monfort (intraweb@xtec.cat) * @param array $blockinfo a blockinfo structure * @return output the rendered bock */ public function display($row) { // Get current content $vars = BlockUtil::varsFromContent($row['content']); // Security check if (!SecurityUtil::checkPermission('IWwebbox:webboxBlock:', $row['title'] . "::", ACCESS_READ)) { return false; } // Add 'http://' if any protocol is specified in the URL if (!parse_url($vars['weburlvalue'], PHP_URL_SCHEME)) { $vars['weburlvalue'] = 'http://' . $vars['weburlvalue']; } if ($vars['titlevalue'] == 1 && $vars['widthvalue'] > 98) $vars['widthvalue'] = 98; $vars['scrolls'] = ($vars['scrollvalue'] == 1) ? 'auto' : 'no'; if (($vars['notunregvalue'] == 1 && !UserUtil::isLoggedIn()) || $vars['notunregvalue'] == '-1') { if ($vars['widthvalue'] != 0) { if ($vars['titlevalue'] == '1') $row['title'] = ''; // Create output object $view = Zikula_View::getInstance('IWwebbox', false); // assign the block vars $view->assign($vars); if (($vars['notunregvalue'] == 1 && !UserUtil::isLoggedIn()) || $vars['notunregvalue'] == '-1') { // Populate block info and pass to theme $row['content'] = $view->fetch('IWwebbox_block_display.htm'); return BlockUtil::themeBlock($row); } } } return false; }
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; }
function modify($blockinfo) { // Security check if (!SecurityUtil::checkPermission("IWstats:usersonlineblock:", "::", ACCESS_ADMIN)) { return; } $vars = BlockUtil::varsFromContent($blockinfo['content']); $refreshtime = (!isset($vars['refreshtime'])) ? 100 : $vars['refreshtime']; $sessiontime = (!isset($vars['sessiontime'])) ? 100 : $vars['sessiontime']; $unsee = (!isset($vars['unsee'])) ? 0 : $vars['unsee']; // create output object $view = Zikula_View::getInstance('IWstats', false); $view->assign('refreshtime', $refreshtime); $view->assign('sessiontime', $sessiontime); $view->assign('unsee', $unsee); return $view->fetch('IWstats_block_editusersonline.htm'); }
/** * modify block settings * * @param array $blockinfo a blockinfo structure * @return output the bock form */ public function modify($blockinfo) { // Break out options from our content field $vars = BlockUtil::varsFromContent($blockinfo['content']); $blockinfo['content'] = ''; // Defaults if (empty($vars['style'])) { $vars['style'] = 1; } // template to use if (empty($vars['template'])) { $vars['template'] = 'menu'; } // stylesheet to use if (empty($vars['stylesheet'])) { $vars['stylesheet'] = ''; } // display modules if (empty($vars['displaymodules'])) { $vars['displaymodules'] = false; } // assign the vars $this->view->assign($vars); $menuitems = array(); if (!empty($vars['content'])) { $contentlines = explode('LINESPLIT', $vars['content']); foreach ($contentlines as $contentline) { $link = explode('|', $contentline); $menuitems[] = $link; } } $this->view->assign('menuitems', $menuitems); // return the output return $this->view->fetch('blocks_block_menu_modify.tpl'); }
/** * modify block settings */ public function modify($blockinfo) { // Create output object $this->view->setCaching(false); // Get current content $vars = BlockUtil::varsFromContent($blockinfo['content']); // Defaults if (empty($vars['feedid'])) { $vars['feedid'] = 1; } if (empty($vars['displayimage'])) { $vars['displayimage'] = 0; } if (empty($vars['displaydescription'])) { $vars['displaydescription'] = 0; } if (empty($vars['alternatelayout'])) { $vars['alternatelayout'] = 0; } if (empty($vars['numitems'])) { $vars['numitems'] = -1; } // The API function is called. The arguments to the function are passed in // as their own arguments array $items = ModUtil::apiFunc('Feeds', 'user', 'getall'); // create an array for feednames and id's for the template $allfeeds = array(); foreach ($items as $item) { $allfeeds[$item['fid']] = $item['name']; } $this->view->assign('allfeeds', $allfeeds); // assign the block vars $this->view->assign($vars); // Return output return $this->view->fetch('block/displayfeed_modify.tpl'); }
/** * 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']); // Read inputs $vars['format'] = FormUtil::getPassedValue('format'); // Read inputs $vars['fulltranslation'] = FormUtil::getPassedValue('fulltranslation'); // Scan for languages and save cached version $vars['languages'] = $this->getAvailableLanguages(); // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('blocks_block_thelang.tpl'); // and clear the theme cache Zikula_View_Theme::getInstance()->clear_cache(); return $blockinfo; }
/** * extract an array of config variables out of the content field of a * block * * @deprecated * @see BlockUtil::varsFromContent() * * @param the $ content from the db */ function pnBlockVarsFromContent($content) { LogUtil::log(__f('Warning! Function %1$s is deprecated. Please use %2$s instead.', array(__FUNCTION__, 'BlockUtil::varsFromContent()')), E_USER_DEPRECATED); return BlockUtil::varsFromContent($content); }
/** * 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', 'slider.tpl', 'POST'); $vars['block_title'] = FormUtil::getPassedValue('block_title', array(), 'POST'); $vars['block_wrap'] = FormUtil::getPassedValue('block_wrap', true, 'POST'); $vars['slider_content'] = FormUtil::getPassedValue('slider_content', array(), 'POST'); $vars['slider_htmlcaption'] = FormUtil::getPassedValue('slider_htmlcaption', array(), 'POST'); $vars['slider_content_editor'] = FormUtil::getPassedValue('slider_content_editor', false, 'POST'); $vars['slider_theme'] = FormUtil::getPassedValue('slider_theme', 'default', 'POST'); $vars['slider_effect'] = FormUtil::getPassedValue('slider_effect', 'random', 'POST'); $vars['slider_slices'] = FormUtil::getPassedValue('slider_slices', 15, 'POST'); $vars['slider_boxCols'] = FormUtil::getPassedValue('slider_boxCols', 8, 'POST'); $vars['slider_boxRows'] = FormUtil::getPassedValue('slider_boxRows', 4, 'POST'); $vars['slider_animSpeed'] = FormUtil::getPassedValue('slider_animSpeed', 500, 'POST'); $vars['slider_pauseTime'] = FormUtil::getPassedValue('slider_pauseTime', 3000, 'POST'); $vars['slider_startSlide'] = FormUtil::getPassedValue('slider_startSlide', 0, 'POST'); $vars['slider_directionNav'] = FormUtil::getPassedValue('slider_directionNav', true, 'POST'); $vars['slider_controlNav'] = FormUtil::getPassedValue('slider_controlNav', true, 'POST'); $vars['slider_controlNavThumbs'] = FormUtil::getPassedValue('slider_controlNavThumbs', false, 'POST'); $vars['slider_pauseOnHover'] = FormUtil::getPassedValue('slider_pauseOnHover', true, 'POST'); $vars['slider_manualAdvance'] = FormUtil::getPassedValue('slider_manualAdvance', false, 'POST'); $vars['slider_randomStart'] = FormUtil::getPassedValue('slider_randomStart', false, 'POST'); // write new values $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('blocks/slider.tpl'); return $blockinfo; }
/** * update block settings * * @author The Zikula Development Team * @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['hourfrom'] = FormUtil::getPassedValue('hourfrom'); $vars['hourto'] = FormUtil::getPassedValue('hourto'); $vars['monfrom'] = FormUtil::getPassedValue('monfrom'); $vars['monto'] = FormUtil::getPassedValue('monto'); $vars['mdayfrom'] = FormUtil::getPassedValue('mdayfrom'); $vars['mdayto'] = FormUtil::getPassedValue('mdayto'); $vars['wdayfrom'] = FormUtil::getPassedValue('wdayfrom'); $vars['wdayto'] = FormUtil::getPassedValue('wdayto'); $vars['cache_time'] = FormUtil::getPassedValue('cache_time'); $vars['cache_dir'] = FormUtil::getPassedValue('cache_dir'); $vars['category'] = FormUtil::getPassedValue('category', null); $ballooncolor = FormUtil::getPassedValue('ballooncolor', 'grey'); // Make sure color is allowed. switch ($ballooncolor) { case 'black': case 'grey': case 'green': case 'white': case 'yellow': break; default: $ballooncolor = 'grey'; } $vars['ballooncolor'] = $ballooncolor; $vars['enablefacebookshare'] = FormUtil::getPassedValue('enablefacebookshare', false); // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('quotes_block_quote.tpl'); return $blockinfo; }
/** * Display an existing Zikula block. * * The block is choosen by its id. * The block state is ignored, so even deactivated blocks can be shown. * The parameters specific to the block can be overridden. * * Available parameters: * - id (numeric) ID of the block to be displayed * - name (string) Name of the block to be displayed (not used) * - title (string) Overrides the block title * - position (string) Overrides the block position * - assign (string) The name of a template variable to which the output * of the block is assigned, instead of sending the * output to the template (optional) * - Any additional parameters are passed to the block as block variables, * overriding any existing values. * * Examples: * * Insert the block with block ID (bid) 4 at the current position in the template * * <samp>{block id=4}</samp> * * Insert the block with block ID (bid) 5 at the current position in the * template, overriding the block's title. * * <samp>{block id=5 title='My Block 5'}</samp> * * Store the output generated by retrieving the block with ID 6 in the template * variable $myBlockContents. * * <samp>{block id=6 assign='myBlockContents'}</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 block. * * @todo the attribute 'name' is not used. * */ function smarty_function_block($params, Zikula_View $view) { $bid = isset($params['bid']) ? (int) $params['bid'] : 0; $name = isset($params['name']) ? $params['name'] : null; $title = isset($params['title']) ? $params['title'] : null; $position = isset($params['position']) ? $params['position'] : null; $assign = isset($params['assign']) ? $params['assign'] : null; // unset the variables for the function, leaving the ones for the block unset($params['bid']); unset($params['name']); unset($params['title']); unset($params['position']); unset($params['assign']); if (!$bid) { $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('pnblock', 'bid'))); return false; } // render the block $blockinfo = BlockUtil::getBlockInfo($bid); // overwrite block title if ($title) { $blockinfo['title'] = $title; } if ($position) { $blockinfo['position'] = $position; } $blockinfo['bid'] = $bid; // bid is not return by BlockGetInfo. // Overwrite block specific config vars. // Only the new style is supported. if (count($params) > 0) { $_vars = BlockUtil::varsFromContent($blockinfo['content']); $_vars = array_merge($_vars, $params); $blockinfo['content'] = BlockUtil::varsToContent($_vars); } // We need the module name. $modinfo = ModUtil::getInfo($blockinfo['mid']); if (!is_array($modinfo) || !isset($modinfo['name'])) { $modinfo = array('name' => 'core'); } // show the block and capture its contents $content = BlockUtil::show($modinfo['name'], $blockinfo['bkey'], $blockinfo); if ($assign) { $view->assign($assign, $content); } else { return $content; } }
/** * 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 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 */ 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; }
/** * update block settings * * @author Erik Spaan [espaan] * @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['show'] = (int)FormUtil::getPassedValue('show', 1, 'POST'); $vars['category'] = FormUtil::getPassedValue('category', null, 'POST'); $vars['limit'] = (int)FormUtil::getPassedValue('limit', 10, 'POST'); $vars['status'] = (int)FormUtil::getPassedValue('status', 0, 'POST'); $vars['order'] = (int)FormUtil::getPassedValue('order', 0, 'POST'); $vars['dayslimit'] = (int)FormUtil::getPassedValue('dayslimit', 0, 'POST'); $vars['maxtitlelength'] = (int)FormUtil::getPassedValue('maxtitlelength', 0, 'POST'); $vars['titlewraptxt'] = FormUtil::getPassedValue('titlewraptxt', null, 'POST'); $vars['showemptyresult'] = (bool)FormUtil::getPassedValue('showemptyresult', false, 'POST'); $vars['blocktemplate'] = FormUtil::getPassedValue('blocktemplate', null, 'POST'); $vars['rowtemplate'] = FormUtil::getPassedValue('rowtemplate', null, 'POST'); $vars['dispuname'] = (bool)FormUtil::getPassedValue('dispuname', false, 'POST'); $vars['dispdate'] = (bool)FormUtil::getPassedValue('dispdate', false, 'POST'); $vars['dateformat'] = FormUtil::getPassedValue('dateformat', null, 'POST'); $vars['dispreads'] = (bool)FormUtil::getPassedValue('dispreads', false, 'POST'); $vars['dispcomments'] = (bool)FormUtil::getPassedValue('dispcomments', false, 'POST'); $vars['dispsplitchar'] = FormUtil::getPassedValue('dispsplitchar', null, 'POST'); $vars['disphometext'] = (bool)FormUtil::getPassedValue('disphometext', false, 'POST'); $vars['maxhometextlength'] = (int)FormUtil::getPassedValue('maxhometextlength', 0, 'POST'); $vars['hometextwraptxt'] = FormUtil::getPassedValue('hometextwraptxt', null, 'POST'); $vars['dispnewimage'] = (bool)FormUtil::getPassedValue('dispnewimage', false, 'POST'); $vars['newimagelimit'] = (int)FormUtil::getPassedValue('newimagelimit', 0, 'POST'); $vars['newimageset'] = FormUtil::getPassedValue('newimageset', null, 'POST'); $vars['newimagesrc'] = FormUtil::getPassedValue('newimagesrc', null, 'POST'); $vars['scrolling'] = (int)FormUtil::getPassedValue('scrolling', 1, 'POST'); $vars['scrollstyle'] = FormUtil::getPassedValue('scrollstyle', null, 'POST'); $vars['scrolldelay'] = (int)FormUtil::getPassedValue('scrolldelay', 0, 'POST'); $vars['scrollmspeed'] = (int)FormUtil::getPassedValue('scrollmspeed', 0, 'POST'); // Check the templates if (!$this->view->template_exists($vars['rowtemplate'])) { $vars['rowtemplate'] = ''; } if (!$this->view->template_exists($vars['blocktemplate'])) { $vars['blocktemplate'] = ''; } // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_all_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; }
/** * Modify the block * * @param $blockinfo blockinfo array * @return string HTML output string */ public function modify($blockinfo) { if (!SecurityUtil::checkPermission('Theme:Renderblock:', "$blockinfo[bid]::", ACCESS_ADMIN)) { return false; } $this->configureView(); // Break out options from our content field $vars = BlockUtil::varsFromContent($blockinfo['content']); // validate the current data $valid = false; $warnings = array(); if (isset($vars['module']) && $vars['module']) { if (ModUtil::available($vars['module'])) { if (isset($vars['template']) && $vars['template']) { $view = Zikula_View::getInstance($vars['module']); if (!$view->template_exists($vars['template'])) { $warnings[] = $this->__f("The specified template does not exist on the '%s' module.", $vars['module']); } else { $valid = true; } } } else { $warnings[] = $this->__f("The module '%s' is not available.", $vars['module']); } } if (!$valid) { $warnings[] = $this->__('With the current setup the block is disabled.'); } // generate the output return $this->view->assign($vars) ->assign('warnings', $warnings) ->fetch('theme_block_render_modify.tpl'); }
/** * modify block settings * * @param array $blockinfo a blockinfo structure * @return output the bock form */ public function modify($blockinfo) { // Break out options from our content field $vars = BlockUtil::varsFromContent($blockinfo['content']); $blockinfo['content'] = ''; // Defaults if (empty($vars['displaymodules'])) { $vars['displaymodules'] = 0; } // template to use if (empty($vars['template'])) { $vars['template'] = 'blocks_block_extmenu.tpl'; } // create default block variables if (!isset($vars['blocktitles'])) { $vars['blocktitles'] = array(); } if (!isset($vars['links'])) { $vars['links'] = array(); } if (!isset($vars['stylesheet'])) { $vars['stylesheet'] = ''; } if (!isset($vars['menuid'])) { $vars['menuid'] = 0; } $languages = ZLanguage::getInstalledLanguages(); $userlanguage = ZLanguage::getLanguageCode(); // filter out invalid languages foreach ($vars['blocktitles'] as $k => $v) { if (!in_array($k, $languages)) { unset($vars['blocktitles'][$k]); unset($vars['links'][$k]); } } // check if the users wants to add a new link via the "Add current url" link in the block $addurl = FormUtil::getPassedValue('addurl', 0, 'GET'); // or if we come from the normal "edit this block" link $fromblock = FormUtil::getPassedValue('fromblock', null, 'GET'); $redirect = ''; if ($addurl == 1) { // set a marker for redirection later on $newurl = System::serverGetVar('HTTP_REFERER'); $redirect = urlencode($newurl); $newurl = str_replace(System::getBaseUrl(), '', $newurl); if (empty($newurl)) { $newurl = System::getHomepageUrl(); } foreach ($languages as $singlelanguage) { $vars['links'][$singlelanguage][] = array('name' => $this->__('--New link--'), 'url' => $newurl, 'title' => $this->__('--New link--'), 'level' => 0, 'parentid' => null, 'image' => '', 'active' => 1); } } elseif (isset($fromblock)) { $redirect = urlencode(System::serverGetVar('HTTP_REFERER')); } // add new languages to the blocktitles and link arrays // we need to know which language has the most links, this language will be the "master" // for new languages to be added. this ensures that all links for the new language // are prepared. $link_master = array(); foreach ($languages as $lang) { if (isset($vars['links'][$lang]) && count($link_master) < count($vars['links'][$lang])) { $link_master = $vars['links'][$lang]; } } foreach ($languages as $lang) { // create an empty blocktitle string if (!array_key_exists($lang, $vars['blocktitles'])) { $vars['blocktitles'][$lang] = ''; } if (!array_key_exists($lang, $vars['links'])) { $vars['links'][$lang] = $link_master; } } // menuitems are sorted by language per default for easier // access when showing them (which is more often necessary than // editing them), but for editing them we need them sorted by id $menuitems = array(); foreach ($vars['links'] as $lang => $langlinks) { // langlinks now contains an array of links for a certain language // sorted by key=id foreach ($langlinks as $linkid => $link) { // pre zk1.2 check if (!isset($link['id'])) { $link['id'] = $linkid; } $link['errors'] = array(); $this->checkImage($link); $menuitems[$linkid][$lang] = $link; } } $vars['links'] = $menuitems; $this->view->setCaching(Zikula_View::CACHE_DISABLED); // assign the vars $this->view->assign($vars)->assign('languages', $languages)->assign('userlanguage', $userlanguage)->assign('redirect', $redirect)->assign('blockinfo', $blockinfo); // return the output return $this->view->fetch('blocks_block_extmenu_modify.tpl'); }
/** * update block settings * * @author The Zikula Development Team * @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['storiestype'] = FormUtil::getPassedValue('storiestype', null, 'POST'); $vars['category'] = FormUtil::getPassedValue('category', null, 'POST'); $vars['limit'] = (int)FormUtil::getPassedValue('limit', null, 'POST'); // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('block/stories.tpl'); 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['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. * * Parameters passed in via POST: * ------------------------------ * string username The user name of the featured user. * array fieldstoshow An array of dud item labels corresponding to the information to display in the block. * boolean showregdate True to show the featured user's registration date, false to supress it. * * @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 variables $vars['username'] = $this->request->getPost()->get('username', null); $vars['fieldstoshow'] = $this->request->getPost()->get('fieldstoshow', null); $vars['showregdate'] = (bool)$this->request->getPost()->get('showregdate', null); if (!isset($vars['fieldstoshow']) || !is_array($vars['fieldstoshow']) || empty($vars['fieldstoshow'])) { $vars['fieldstoshow'] = array(); } // validate the passed duds if (!empty($vars['fieldstoshow'])) { $activeduds = ModUtil::apiFunc('Profile', 'user', 'getallactive'); $activeduds = array_keys($activeduds); foreach ($vars['fieldstoshow'] as $k => $v) { if (!in_array($v, $activeduds)) { unset($vars['fieldstoshow'][$k]); } } } // write back the new contents $blockinfo['content'] = BlockUtil::varsToContent($vars); // clear the block cache $this->view->clear_cache('profile_block_featureduser.tpl'); return $blockinfo; }