';
}
}
/**
* DisplayBookmarks
* Output bookmark data. Over-ride this to alter display of Bookmark information.
* Bookmark objects contain two useful fields: title and url
*
*
* @param marks - this is an array of Bookmark Objects
*/
function DisplayBookmarks($marks)
{
//echo "
\n";
}
/**
* StartRighthandColumn
* Override this for different behavior or special functionality
* for the righthand column. Usual use would be a div open tag.
*/
function StartRighthandColumn()
{
echo '
';
echo "\n";
echo '
';
}
/**
* EndRighthandColumn
* Override this for different behavior or special functionality
* for the righthand column. Usual use would be a div close tag.
*/
function EndRighthandColumn()
{
echo "
\n
\n";
}
/**
* OutputHeaderJavascript
* This method can be used to dump out any javascript you'd like into the
* Admin page header. In fact, it can be used to put just about anything into
* the page header. It's recommended that you leave or copy the javascript
* below into your own method if you override this -- it's used by the dropdown
* menu in IE.
*/
function OutputHeaderJavascript()
{
$config = cmsms()->GetConfig();
$ssl = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off');
$ssl = $ssl && isset($config['ssl_url']);
return cms_get_jquery('',$ssl);
}
/**
* OutputFooterJavascript
* This method can be used to dump out any javascript you'd like into the
* Admin page footer.
* It's recommended that you leave or copy the javascript below into your
* own method if you override this -- it's used by bookmarks/recent pages tabs.
*/
function OutputFooterJavascript()
{
echo "";
}
/**
* DisplaySectionPages
* Shows admin section pages in the specified section, wrapped in a
* MainMenuItem div. This is used in the top-level section pages.
*
* You can override this if you want to change the
* way it is shown.
*
* @param section - section to display
*/
public function DisplaySectionPages($section)
{
if (count($this->menuItems) < 1) {
// menu should be initialized before this gets called.
// TODO: try to do initialization.
// Problem: current page selection, url, etc?
return -1;
}
foreach ($this->menuItems[$section]['children'] as $thisChild) {
$thisItem = $this->menuItems[$thisChild];
if (! $thisItem['show_in_menu'] || strlen($thisItem['url']) < 1) continue;
echo "
\n";
}
}
/**
* TopParent
* This method returns the menu node that is the top-level parent of the node you pass
* to it.
*
* @param section - section (menu tag) to find top-level parent
*/
function TopParent($section)
{
$next = $section;
$node = $this->menuItems[$next];
while ($node['parent'] != -1) {
$next = $node['parent'];
$node = $this->menuItems[$next];
}
return $next;
}
/**
* ListSectionPages
* This method presents a nice, human-readable list of admin pages and
* modules that are in the specified admin section.
*
*
* @param section - section to display
*/
function ListSectionPages($section)
{
if (! isset($this->menuItems[$section]['children']) || count($this->menuItems[$section]['children']) < 1) return;
if ($this->HasDisplayableChildren($section)) {
echo " ".lang('subitems').": ";
$count = 0;
foreach($this->menuItems[$section]['children'] as $thisChild) {
$thisItem = $this->menuItems[$thisChild];
if (! $thisItem['show_in_menu'] || strlen($thisItem['url']) < 1) continue;
if ($count++ > 0) echo ', ';
echo "".$thisItem['title']."";
}
}
}
/**
* DisplayAllSectionPages
*
* Shows all admin section pages and modules. This is used to display the
* admin "main" page.
*
*/
public function DisplayAllSectionPages()
{
if (count($this->menuItems) < 1) {
// menu should be initialized before this gets called.
// TODO: try to do initialization.
// Problem: current page selection, url, etc?
return -1;
}
foreach ($this->menuItems as $thisSection=>$menuItem) {
if ($menuItem['parent'] != -1) continue;
if (! $menuItem['show_in_menu']) continue;
echo "
";
return;
}
/**
* DisplayTopMenu
* Output Top Menu data. Over-ride this to alter display of the top menu.
*
* @param menuItems an array of associated items; each element has a section, title,
* url, and selection where title and url are strings, and selection is a boolean
* to indicate this is the current selection. You can use the "section" to trap for
* javascript links, etc.
*
* Cruftily written to only support a depth of two levels
*
*/
function DisplayTopMenu()
{
echo "
\n";
$menuitems = $this->get_admin_navigation();
foreach ( $menuitems as $key=>$menuItem) {
if ($menuItem['parent'] == -1) $this->renderMenuSection($key, 0, -1);
}
echo "
\n";
}
/**
* DisplayFooter
* Displays an end-of-page footer.
*/
function DisplayFooter()
{
?>
CMS Made Simple™ is Free Software released under the GNU/GPL License
\n";
}
/**
* DisplayHTMLStartTag
* Outputs the html open tag. Override at your own risk :)
*/
function DisplayHTMLStartTag()
{
$info = CmsNlsOperations::get_language_info(CmsNlsOperations::get_current_language());
echo ($info->direction() == 'rtl') ? "" : "\n";
}
/**
* @since 1.9
* ThemeHeader
* This method outputs the HEAD section of the html page in the admin Theme section,
* after OutputHeaderJavascript() and before $addt.
*/
function ThemeHeader(){
if(file_exists('themes/'. $this->themeName. '/includes/standard.js')) {
return ''."\n";
}
}
/**
* DisplayHTMLHeader
* This method outputs the HEAD section of the html page in the admin section.
*/
public function DisplayHTMLHeader($showielink = false, $addt = '')
{
$x = $this->breadcrumbs; // dummy function to trigger the navigation being built early.
$config = cmsms()->GetConfig();
$urlext = CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY];
$title = get_site_preference('sitename').' - '.$this->title;
$str = "\r\n";
$str .=
<<{$title}
EOT;
if ($showielink) {
$str .=
<<
EOT;
}
$str .= $this->OutputHeaderJavascript()."\n";
$str .= "\n";
ob_start();
$tmp1 = $this->ThemeHeader();
$tmp2 = ob_get_contents();
ob_end_clean();
if( $tmp1 ) {
// data is returned
$str .= $tmp1;
}
else {
// assume data is echoed
$str .= $tmp2;
}
$str .= $addt."\n";
$str .= "\n"; // fix to correct and add the end header tag -- JLB
echo $str;
}
/**
* DisplayBodyTag
* Outputs the admin page body tag. Leave in the funny text if you want this
* to work properly.
*/
public function DisplayBodyTag()
{
echo "\n";
}
/**
* DisplayMainDivStart
*
* Used to output the start of the main div that contains the admin page content
*/
public function DisplayMainDivStart()
{
echo "
\n";
}
/**
* DisplayMainDivEnd
*
* Used to output the end of the main div that contains the admin page content
*/
public function DisplayMainDivEnd()
{
echo '';
echo "
\n";
}
/**
* DisplaySectionMenuDivStart
* Outputs the open div tag for the main section pages.
*/
public function DisplaySectionMenuDivStart()
{
echo "
\n";
}
/**
* DisplaySectionMenuDivEnd
* Outputs the close div tag for the main section pages.
*/
public function DisplaySectionMenuDivEnd()
{
echo "
\n";
if (get_preference($this->userid, 'bookmarks')) {
echo "
\n";
}
}
/**
* Display the available notifications
*
* @param string $priority Priority threshold
* @return void
*/
function DisplayNotifications($priority=2)
{
$tnotifications = $this->get_notifications();
if( count($tnotifications) == 0 ) return;
// count the total number of notifications
$count=0;
for( $i = 0; $i < count($tnotifications); $i++ ) {
if( $tnotifications[$i]->priority <= $priority ) $count++;
}
// Define that is singular or plural
$singular_or_plural = $count;
if($singular_or_plural > 1) {
$tmp = lang('notifications_to_handle',$count);
}
else {
$tmp = lang('notification_to_handle',$count);
}
// remove html tags like 2
$no_html_tags = preg_replace('/(<\/?)(\w+)([^>]*>)/e','',$tmp);
echo '
\n";
}
/**
* ShowHeader
* Outputs the page header title along with a help link to that section in the wiki.
*
* @param title_name - page heading title
* @param extra_lang_param - extra parameters to pass to lang() (I don't think this parm is needed)
* @param link_text - Override the text to use for the help link.
* @param module_help_type - FALSE if this is not a module, 'both' if link to
* both the wiki and module help and 'builtin' if link to to the builtin help
*/
public function ShowHeader($title_name, $extra_lang_param=array(), $link_text = '', $module_help_type = FALSE)
{
$cms = cmsms();
$config = $cms->GetConfig();
$header = '
';
if (FALSE != $module_help_type) {
$module = '';
if( isset($_REQUEST['module']) ) {
$module = $_REQUEST['module'];
}
else if( isset($_REQUEST['mact']) ) {
$tmp = explode(',',$_REQUEST['mact']);
$module = $tmp[0];
}
$icon = "modules/{$module}/images/icon.gif";
$path = cms_join_path(cmsms()->config['root_path'],$icon);
if( file_exists($path) ) {
$url = $config->smart_root_url().'/'.$icon;
$header .= " ";
}
$header .= $title_name;
}
else {
$header .= lang($title_name, $extra_lang_param);
}
if (count($this->breadcrumbs)) {
foreach ($this->breadcrumbs AS $key => $value) {
$title = $value['title'];
// If this is a module and the last part of the breadcrumbs
if (FALSE != $module_help_type && TRUE == empty($this->breadcrumbs[$key + 1])) {
if (FALSE == empty($_GET['module'])) {
$module_name = $_GET['module'];
}
else {
$module_name = substr($_REQUEST['mact'], 0, strpos($_REQUEST['mact'], ','));
}
// Turn ModuleName into _Module_Name
$moduleName = preg_replace('/([A-Z])/', "_$1", $module_name);
$moduleName = preg_replace('/_([A-Z])_/', "$1", $moduleName);
if ($moduleName{0} == '_') $moduleName = substr($moduleName, 1);
} else {
// Remove colon and following (I.E. Turn "Edit Page: Title" into "Edit Page")
$colonLocation = strrchr($title, ':');
if ($colonLocation !== false) $title = substr($title,0,strpos($title,':'));
// Get the key of the title so we can use the en_US version for the URL
$title_key = $this->_ArraySearchRecursive($title, $this->menuItems);
}
}
if (FALSE == get_preference($this->userid, 'hide_help_links', 0)) {
$urlext='?'.CMS_SECURE_PARAM_NAME.'='.$_SESSION[CMS_USER_KEY];
$image_help = $this->DisplayImage('icons/system/info.gif', lang('module_help'),'','','systemicon');
//$image_help_external = $this->DisplayImage('icons/system/info-external.gif', lang('wikihelp'),'','','systemicon');
if ('both' == $module_help_type) {
$module_help_link = $config['admin_url'].'/listmodules.php'.$urlext.'&action=showmodulehelp&module='.$module_name;
$header .= ''.$image_help.''.lang('module_help').'';
}
}
}
$header .= '
';
return $header;
}
/**
* _ArraySearchRecursive
* recursively descend an arbitrarily deep multidimensional
* array, stopping at the first occurence of scalar $needle.
* return the path to $needle as an array (list) of keys
* if not found, return null.
* (will infinitely recurse on self-referential structures)
* From: http://us3.php.net/function.array-search
*/
private function _ArraySearchRecursive($needle, $haystack)
{
$path = NULL;
$keys = array_keys($haystack);
while (!$path && (list($toss,$k)=each($keys))) {
$v = $haystack[$k];
if (is_scalar($v)) {
if ($v===$needle) $path = array($k);
} elseif (is_array($v)) {
if ($path=$this->_ArraySearchRecursive( $needle, $v )) array_unshift($path,$k);
}
}
return $path;
}
/**
* ShowError
* Outputs supplied errors with a link to the wiki for troublshooting.
*
* @param errors - array or string of 1 or more errors to be shown
* @param get_var - Name of the _GET variable that contains the
* name of the message lang string
*/
public function ShowErrors($errors, $get_var = '')
{
$config = cmsms()->GetConfig();
$image_error = $this->DisplayImage('icons/system/stop.gif', lang('error'),'','','systemicon');
$output = '