[ Index ]
 

Code source de CMS made simple 1.0.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/classes/contenttypes/ -> SectionHeader.inc.php (source)

   1  <?php
   2  # CMS - CMS Made Simple
   3  # (c)2004 by Ted Kulp (tedkulp@users.sf.net)
   4  # This project's homepage is: http://cmsmadesimple.org
   5  #
   6  # This program is free software; you can redistribute it and/or modify
   7  # it under the terms of the GNU General Public License as published by
   8  # the Free Software Foundation; either version 2 of the License, or
   9  # (at your option) any later version.
  10  #
  11  # This program is distributed in the hope that it will be useful,
  12  # BUT withOUT ANY WARRANTY; without even the implied warranty of
  13  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14  # GNU General Public License for more details.
  15  # You should have received a copy of the GNU General Public License
  16  # along with this program; if not, write to the Free Software
  17  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18  #
  19  #$Id: SectionHeader.inc.php 3465 2006-10-09 14:04:47Z dittmann $
  20  
  21  class SectionHeader extends ContentBase
  22  {
  23  
  24      function SectionHeader() {
  25          $this->ContentBase();
  26          $this->mProperties->SetAllowedPropertyNames(array());
  27      }
  28  
  29      function FriendlyName()
  30      {
  31      return 'Section Header';
  32      }
  33  
  34      function SetProperties()
  35      {
  36      #Turn off caching
  37      $this->mCachable = false;
  38      }
  39  
  40      function HasUsableLink()
  41      {
  42      return false;
  43      }
  44  
  45      function FillParams($params)
  46      {
  47      if (isset($params))
  48      {
  49          if (isset($params['title']))
  50          {
  51          $this->mName = $params['title'];
  52          }
  53          if (isset($params['menutext']))
  54          {
  55          $this->mMenuText = $params['menutext'];
  56          }
  57          if (isset($params['parent_id']))
  58          {
  59          if ($this->mParentId != $params['parent_id'])
  60          {
  61              $this->mHierarchy = '';
  62              $this->mItemOrder = -1;
  63          }
  64          $this->mParentId = $params['parent_id'];
  65          }
  66          if (isset($params['active']))
  67          {
  68          $this->mActive = true;
  69          }
  70          else
  71          {
  72          $this->mActive = false;
  73          }
  74          if (isset($params['showinmenu']))
  75          {
  76          $this->mShowInMenu = true;
  77          }
  78          else
  79          {
  80          $this->mShowInMenu = false;
  81          }
  82          if (isset($params['alias']))
  83          {
  84          $this->SetAlias($params['alias']);
  85          }
  86      }
  87      }
  88  
  89      function ValidateData()
  90      {
  91      $result = true;
  92      $errors = array();
  93      
  94      if ($this->mName == '')
  95      {
  96          $errors[]= lang('nofieldgiven',array(lang('title')));
  97          $result = false;
  98      }
  99  
 100      if ($this->mMenuText == '')
 101      {
 102          $errors[]= lang('nofieldgiven',array(lang('menutext')));
 103          $result = false;
 104      }
 105  
 106      return (count($errors) > 0?$errors:FALSE);
 107      }
 108  
 109      function Show()
 110      {
 111      }
 112  
 113      function EditAsArray($adding = false, $tab = 0, $showadmin = false)
 114      {
 115      global $gCms;
 116      
 117      $ret = array();
 118  
 119      $ret[]= array(lang('title').':','<input type="text" name="title" value="'.cms_htmlentities($this->mName).'" />');
 120      $ret[]= array(lang('menutext').':','<input type="text" name="menutext" value="'.cms_htmlentities($this->mMenuText).'" />');
 121      $ret[]= array(lang('pagealias').':','<input type="text" name="alias" value="'.$this->mAlias.'" />');
 122      if (check_permission(get_userid(), 'Modify Page Structure') || ($adding == true && check_permission(get_userid(), 'Add Pages')))
 123      {
 124          $contentops =& $gCms->GetContentOperations();
 125          $ret[]= array(lang('parent').':', $contentops->CreateHierarchyDropdown($this->mId, $this->mParentId));
 126      }
 127      $ret[]= array(lang('active').':','<input type="checkbox" name="active"'.($this->mActive?' checked="checked"':'').' />') ;
 128      $ret[]= array(lang('showinmenu').':','<input type="checkbox" name="showinmenu"'.($this->mShowInMenu?' checked="checked"':'').' />');
 129  
 130      if (!$adding && $showadmin)
 131      {
 132          $userops =& $gCms->GetUserOperations();
 133          $ret[]= array(lang('owner').':', $userops->GenerateDropdown($this->Owner()));
 134      }
 135  
 136      if ($adding || $showadmin)
 137      {
 138          $ret[]= $this->ShowAdditionalEditors();
 139      }
 140  
 141      return $ret;
 142      }
 143  
 144      function GetURL($rewrite = true)
 145      {
 146      return '#';
 147      }
 148  }
 149  
 150  # vim:ts=4 sw=4 noet
 151  ?>


Généré le : Tue Apr 3 18:50:37 2007 par Balluche grâce à PHPXref 0.7