function toHTML($label, $name) { $link = expCore::makeLink(array("module" => $this->controller->baseclassname, "action" => "edit", "parent" => 0)); $html = ""; if ($this->menu == "true") { if ($this->addable) { $html = '<a class="add" href="' . $link . '">Add a Category</a> | '; } $html .= '<a href="#" id="expandall">Expand All</a> | '; $html .= '<a href="#" id="collapseall">Collapse All</a>'; } $html .= ' <div id="' . $this->id . '" class="nodetree"></div> <div class="loadingdiv">Loading Categories</div>'; foreach ($this->tags as $i => $val) { if (!empty($this->values) && in_array($val->id, $this->values)) { $this->tags[$i]->value = true; } else { $this->tags[$i]->value = false; } $this->tags[$i]->draggable = $this->draggable; $this->tags[$i]->checkable = $this->checkable; } $obj = json_encode($this->tags); $script = "\n\t\tEXPONENT.YUI3_CONFIG.modules = {\n 'exp-tree' : {\n fullpath: EXPONENT.PATH_RELATIVE+'framework/core/assets/js/exp-tree.js',\n requires : ['node','yui2-container','yui2-menu','yui2-treeview','yui2-animation','yui2-dragdrop','yui2-json','yui2-connection']\n }\n }\n\n \t\t//EXPONENT.YUI3_CONFIG.filter = \".js\";\n\n YUI(EXPONENT.YUI3_CONFIG).use('node','exp-tree', function(Y) {\n \t\t\tvar obj2json = " . $obj . ";\n\t\t\t\tEXPONENT.DragDropTree.init('" . $this->id . "',obj2json,'" . $this->modelname . "','" . $this->menu . "','" . $this->expandonstart . "');\n\t\t\t\tY.one('.nodetree').next().remove();\n\t\t\t});\n\t\t"; // exponent_javascript_toFoot('expddtree', 'treeview,menu,animation,dragdrop,json,container,connection', null, $script, PATH_RELATIVE.'framework/core/assets/js/exp-tree.js'); expJavascript::pushToFoot(array("unique" => 'expddtree', "yui3mods" => 1, "content" => $script)); return $html; }
/** * Smarty {link} function plugin * * Type: function<br> * Name: link<br> * Purpose: create a link * * @param $params * @param \Smarty $smarty * @return bool */ function smarty_function_link($params, &$smarty) { $loc = $smarty->getTemplateVars('__loc'); if ($params['parse_attrs']) { $record = $params['record']; foreach ($params['parse_attrs'] as $key => $value) { $params[$key] = $value; if ($params['showby']) { $params[$params['showby']] = $record->{$params}['showby']; unset($params['showby']); } } unset($params['parse_attrs']); unset($params['record']); } // if the module wasn't passed in we will assume it is the same as the module for this view if (!isset($params['module']) && !isset($params['controller'])) { $params['module'] = $loc->mod; } // make sure the module isn't really a controller if (expModules::controllerExists($params['module'])) { $params['controller'] = $params['module']; unset($params['module']); } // guess the src if it is not set if (!isset($params['src'])) { if (!empty($params['controller']) || @call_user_func(array($loc->mod, 'hasSources'))) { $params['src'] = $loc->src; } } // greb the int value if (!isset($params['int'])) { $params['int'] = $loc->int; } echo expCore::makeLink($params); }
# # Exponent is free software; you can redistribute # it and/or modify it under the terms of the GNU # General Public License as published by the Free # Software Foundation; either version 2 of the # License, or (at your option) any later version. # # GPL: http://www.gnu.org/licenses/gpl.txt # ################################################## if (!defined('EXPONENT')) { exit(''); } //$nav = navigationmodule::levelTemplate(intval($_REQUEST['id'], 0)); $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $nav = $db->selectObjects('section', 'parent=' . $id, 'rank'); $manage_all = false; if (expPermissions::check('manage', expCore::makeLocation('navigationmodule', '', $id))) { $manage_all = true; } $navcount = count($nav); for ($i = 0; $i < $navcount; $i++) { if ($manage_all || expPermissions::check('manage', expCore::makeLocation('navigationmodule', '', $nav[$i]->id))) { $nav[$i]->manage = 1; } else { $nav[$i]->manage = 0; } $nav[$i]->link = expCore::makeLink(array('section' => $nav[$i]->id), '', $nav[$i]->sef_name); } $nav[$navcount - 1]->last = true; echo expJavascript::ajaxReply(201, '', $nav);
<a href="<?php echo expCore::makeLink(array('section' => SITE_DEFAULT_SECTION)); ?> "><?php echo gt('Home'); ?> </a> | <a href="<?php echo expCore::makeLink(array('section' => 16)); ?> "><?php echo gt('Contact Us'); ?> </a> | <a href="<?php echo expCore::makeLink(array('section' => 10)); ?> "><?php echo gt('Site-map'); ?> </a> </div> <div id="header-login"> <?php expTheme::module(array("controller" => "login", "action" => "showlogin", "view" => "showlogin_expanded")); ?> </div> </div> <!-- navigation --> <div id="menu"> <?php
function getRSSContent($loc) { global $db; //Get this modules configuration data $config = $db->selectObject('calendarmodule_config', "location_data='" . serialize($loc) . "'"); //If this module was configured as an aggregator, then turn off check for the location_data $locsql = "(location_data='" . serialize($loc) . "'"; if (!empty($config->aggregate)) { $locations = unserialize($config->aggregate); foreach ($locations as $source) { $tmploc = null; $tmploc->mod = 'calendarmodule'; $tmploc->src = $source; $tmploc->int = ''; $locsql .= " OR location_data='" . serialize($tmploc) . "'"; } } $locsql .= ')'; $day = expDateTime::startOfDayTimestamp(time()); if ($config->rss_limit > 0) { $rsslimit = " AND date <= " . ($day + $config->rss_limit * 86400); } else { $rsslimit = ""; } $cats = $db->selectObjectsIndexedArray("category"); $cats[0] = null; $cats[0]->name = 'None'; //Get this modules items $items = array(); $dates = null; $sort_asc = true; // For the getEventsForDates call $dates = $db->selectObjects("eventdate", $locsql . " AND date >= " . $day . $rsslimit . " ORDER BY date ASC "); $items = calendarmodule::_getEventsForDates($dates, $sort_asc); //Convert the events to rss items $rssitems = array(); foreach ($items as $key => $item) { $rss_item = new FeedItem(); $rss_item->title = $item->title; $rss_item->description = $item->body; $rss_item->date = date('r', $item->eventstart); // $rss_item->date = date('r', $item->posted); // $rss_item->link = "http://".HOSTNAME.PATH_RELATIVE."index.php?module=calendarmodule&action=view&id=".$item->id."&src=".$loc->src; $rss_item->link = expCore::makeLink(array('module' => 'calendarmodule', 'action' => 'view', 'id' => $item->id, 'date_id' => $item->eventdate->id)); if ($config->enable_categories == 1) { $rss_item->category = array($cats[$item->category_id]->name); } $rssitems[$key] = $rss_item; } return $rssitems; }
/** * module customized function to circumvent going to previous page * @return void */ function saveconfig() { // unset some unneeded params unset($this->params['module']); unset($this->params['controller']); unset($this->params['src']); unset($this->params['int']); unset($this->params['id']); unset($this->params['action']); unset($this->params['PHPSESSID']); // setup and save the config $config = new expConfig($this->loc); $config->update(array('config' => $this->params)); // update our object config $this->config = expUnserialize($config->config); // flash('message', 'Migration Configuration Saved'); // expHistory::back(); if (isset($this->params['fix_database'])) { $this->fix_database(); } echo '<h2>' . gt('Migration Configuration Saved') . '</h2><br />'; echo '<p>' . gt('We\'ve successfully connected to the Old database') . '</p><br />'; echo "<a class=\"awesome " . BTN_SIZE . " " . BTN_COLOR . "\" href=\"" . expCore::makeLink(array('controller' => 'migration', 'action' => 'manage_users')) . "\">" . gt('Next Step -> Migrate Users & Groups') . "</a>"; }
/** * returns all the section's children * * @static * @param $parent top level parent id * @param int $depth variable to hold level of recursion * @param array $parents * * @return array */ static function levelTemplate($parent, $depth = 0, $parents = array()) { if ($parent != 0) { $parents[] = $parent; } global $db, $user; $nodes = array(); $cache = expSession::getCacheValue('navigationmodule'); if (!isset($cache['kids'][$parent])) { $kids = $db->selectObjects('section', 'parent=' . $parent); $cache['kids'][$parent] = $kids; expSession::setCacheValue('navigationmodule', $cache); } else { $kids = $cache['kids'][$parent]; } $kids = expSorter::sort(array('array' => $kids, 'sortby' => 'rank', 'order' => 'ASC')); for ($i = 0; $i < count($kids); $i++) { $child = $kids[$i]; //foreach ($kids as $child) { if ($child->public == 1 || expPermissions::check('view', expCore::makeLocation('navigationmodule', '', $child->id))) { $child->numParents = count($parents); $child->depth = $depth; $child->first = $i == 0 ? 1 : 0; $child->last = $i == count($kids) - 1 ? 1 : 0; $child->parents = $parents; $child->canManage = isset($user->is_acting_admin) && $user->is_acting_admin == 1 ? 1 : 0; $child->canManageRank = $child->canManage; if (!isset($child->sef_name)) { $child->sef_name = ''; } // Generate the link attribute base on alias type. if ($child->alias_type == 1) { // External link. Set the link to the configured website URL. // This is guaranteed to be a full URL because of the // section::updateExternalAlias() method in datatypes/section.php $child->link = $child->external_link; } else { if ($child->alias_type == 2) { // Internal link. // Need to check and see if the internal_id is pointing at an external link. $dest = $db->selectObject('section', 'id=' . $child->internal_id); if ($dest->alias_type == 1) { // This internal alias is pointing at an external alias. // Use the external_link of the destination section for the link $child->link = $dest->external_link; } else { // Pointing at a regular section. This is guaranteed to be // a regular section because aliases cannot be turned into sections, // (and vice-versa) and because the section::updateInternalLink // does 'alias to alias' dereferencing before the section is saved // (see datatypes/section.php) //added by Tyler to pull the descriptions through for the children view $child->description = $dest->description; $child->link = expCore::makeLink(array('section' => $child->internal_id)); } } else { // Normal link. Just create the URL from the section's id. $child->link = expCore::makeLink(array('section' => $child->id), '', $child->sef_name); } } //$child->numChildren = $db->countObjects('section','parent='.$child->id); $nodes[] = $child; $nodes = array_merge($nodes, navigationmodule::levelTemplate($child->id, $depth + 1, $parents)); } } return $nodes; }
/** * Smarty {icon} function plugin * * Type: function<br> * Name: icon<br> * Purpose: create an icon type link * * @param $params * @param \Smarty $smarty * @return bool */ function smarty_function_icon($params, &$smarty) { $loc = $smarty->getTemplateVars('__loc'); if (isset($params['record'])) { $record = $params['record']; $params['id'] = $record->id; } if ($record && empty($params['id'])) { $params['id'] = $record->id; } // setup the link params if (!isset($params['controller'])) { if (!isset($params['module'])) { $params['module'] = $loc->mod; } if (expModules::controllerExists($params['module'])) { $params['controller'] = expModules::getControllerName($params['module']); unset($params['module']); } } // guess the src if it is not set if (!isset($params['src'])) { if ($record) { $modloc = expUnserialize($record->location_data); $params['src'] = $modloc->src; } else { if (!empty($params['controller']) || @call_user_func(array($loc->mod, 'hasSources'))) { $params['src'] = $loc->src; } } } if (!is_object($smarty->getTemplateVars('config')) && !empty($smarty->getTemplateVars('config')->noeditagg) && $smarty->getTemplateVars('__loc')->src != $params['src']) { return; } if (!isset($params['int'])) { $params['int'] = $loc->int; } // attempt to translate the alt, text, & title if (!empty($params['alt'])) { $params['alt'] = gt($params['alt']); } if (!empty($params['text'])) { $params['text'] = gt($params['text']); } if (!empty($params['title'])) { $params['title'] = gt($params['title']); } // figure out whether to use the edit icon or text, alt tags, etc. $alt = empty($params['alt']) ? '' : $params['alt']; $class = empty($params['class']) && empty($params['img']) ? $params['action'] : $params['class']; $text = empty($params['text']) ? '' : $params['text']; $title = empty($params['title']) ? empty($text) ? ucfirst($class) . ' ' . gt('this') . ' ' . $smarty->getTemplateVars('modelname') . ' ' . gt('item') : $text : $params['title']; if (!empty($params['hash'])) { $hash = $params['hash']; unset($params['hash']); } if (empty($params['img']) && empty($params['text'])) { $img = gt(ucfirst($class)); } else { if (!empty($params['img'])) { $img = '<img src="' . ICON_RELATIVE . $params['img'] . '" title="' . $title . '" alt="' . $alt . '"' . XHTML_CLOSING . '>'; } } $linktext = $img . $text; // we need to unset these vars before we pass the params array off to makeLink unset($params['alt']); unset($params['title']); unset($params['text']); unset($params['img']); unset($params['class']); unset($params['record']); unset($params['record']); $onclick = $params['onclick']; unset($params['onclick']); //eDebug($params); if (!empty($params['action'])) { echo '<a href="' . expCore::makeLink($params) . '" title="' . $title . '" class="' . $class . '"'; if ($params['action'] == "delete" && empty($onclick)) { echo ' onclick="return confirm(\'' . gt('Are you sure you want to delete this') . ' ' . $smarty->getTemplateVars('modelname') . ' ' . gt('item') . '?\');"'; } if (!empty($onclick)) { echo ' onclick="' . $onclick . '"'; } echo '>' . $linktext . '</a>'; } else { echo $linktext; } }