芝麻web文件管理V1.00
编辑当前文件:/home/p/r/i/prismawe/clients/canaldegap.fr_old/lib/classes/contenttypes/PageLink.inc.php
RemoveProperty('cachable',1); //$this->RemoveProperty('showinmenu',1); $this->AddContentProperty('page',10,1,'int'); $this->AddContentProperty('params',10,1); //Turn off caching $this->mCachable = false; } function FillParams($params) { parent::FillParams($params); if (isset($params)) { $parameters = array('page', 'params' ); foreach ($parameters as $oneparam) { if (isset($params[$oneparam])) { $this->SetPropertyValue($oneparam, $params[$oneparam]); } } } } function ValidateData() { $errors = parent::ValidateData(); if( $errors === FALSE ) { $errors = array(); } global $gCms; $contentops =& $gCms->GetContentOperations(); $page = $this->GetPropertyValue('page'); if ($page == '-1') { $errors[]= lang('nofieldgiven',array(lang('page'))); $result = false; } // get the content type of page. else { $destobj =& $contentops->LoadContentFromID($page); if( !is_object($destobj) ) { $errors[] = lang('destinationnotfound'); $result = false; } else if( $destobj->Type() == 'pagelink' ) { $errors[] = lang('pagelink_circular'); $result = false; } else if( $destobj->Alias() == $this->mAlias ) { $errors[] = lang('pagelink_circular'); $result = false; } } return (count($errors) > 0?$errors:FALSE); } function TabNames() { $res = array(lang('main')); if( check_permission(get_userid(),'Manage All Content') ) { $res[] = lang('options'); } return $res; } function display_single_element($one,$adding) { switch($one) { case 'page': { global $gCms; $contentops =& $gCms->GetContentOperations(); $tmp = $contentops->CreateHierarchyDropdown($this->mId, $this->GetPropertyValue('page'), 'page', 1); if( !empty($tmp) ) return array(lang('destination_page').':',$tmp); } break; case 'params': { $val = cms_htmlentities($this->GetPropertyValue('params')); return array(lang('additional_params').':','
'); } break; default: return parent::display_single_element($one,$adding); } } function EditAsArray($adding = false, $tab = 0, $showadmin = false) { switch($tab) { case '0': return $this->display_attributes($adding); break; case '1': return $this->display_attributes($adding,1); break; } } function GetURL($rewrite = true) { $page = $this->GetPropertyValue('page'); $params = $this->GetPropertyValue('params'); global $gCms; $contentops =& $gCms->GetContentOperations(); $destcontent =& $contentops->LoadContentFromId($page); if( is_object( $destcontent ) ) { $url = $destcontent->GetURL(); $url .= $params; return $url; } } } # vim:ts=4 sw=4 noet ?>