[ 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/module_support/ -> modmisc.inc.php (source)

   1  <?php
   2  # CMS - CMS Made Simple
   3  # (c)2004-6 by Ted Kulp (ted@cmsmadesimple.org)
   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$
  20  
  21  /**
  22   * Methods for modules to do miscellaneous functions
  23   *
  24   * @since        1.0
  25   * @package        CMS
  26   */
  27  
  28  function cms_module_GetAbout(&$modinstance)
  29  {
  30      $str = '';
  31      if ($modinstance->GetAuthor() != '')
  32      {
  33          $str .= "<br />".lang('author').": " . $modinstance->GetAuthor();
  34          if ($modinstance->GetAuthorEmail() != '')
  35          {
  36              $str .= ' &lt;' . $modinstance->GetAuthorEmail() . '&gt;';
  37          }
  38          $str .= "<br />";
  39      }
  40      $str .= "<br />".lang('version').": " .$modinstance->GetVersion() . "<br />";
  41  
  42      if ($modinstance->GetChangeLog() != '')
  43      {
  44          $str .= "<br />".lang('changehistory').":<br />";
  45          $str .= $modinstance->GetChangeLog() . '<br />';
  46      }
  47      return $str;
  48  }
  49  
  50  function cms_module_GetHelpPage(&$modinstance)
  51  {
  52      $str = '';
  53      @ob_start();
  54      echo $modinstance->GetHelp();
  55      $str .= @ob_get_contents();
  56      @ob_end_clean();
  57      $dependencies = $modinstance->GetDependencies();
  58      if (count($dependencies) > 0 )
  59      {
  60          $str .= '<h3>'.lang('dependencies').'</h3>';
  61          $str .= '<ul>';
  62          foreach( $dependencies as $dep => $ver )
  63          {
  64              $str .= '<li>';
  65              $str .= $dep.' =&gt; '.$ver;
  66              $str .= '</li>';
  67          }
  68          $str .= '</ul>';
  69      }
  70      $paramarray = $modinstance->GetParameters();
  71      if (count($paramarray) > 0)
  72      {
  73          $str .= '<h3>'.lang('parameters').'</h3>';
  74          $str .= '<ul>';
  75          foreach ($paramarray as $oneparam)
  76          {
  77              $str .= '<li>';
  78              if ($oneparam['optional'] == true)
  79              {
  80                  $str .= '<em>(optional)</em> ';
  81              }
  82              $str .= $oneparam['name'].'="'.$oneparam['default'].'" - '.$oneparam['help'].'</li>';
  83          }
  84          $str .= '</ul>';
  85      }
  86      return $str;
  87  }
  88  
  89  function cms_module_CreatePagination(&$modinstance, $id, $action, $returnid, $page, $totalrows, $limit, $inline=false)
  90  {
  91      global $gCms;
  92      $config =& $gCms->GetConfig();
  93  
  94      $goto = 'index.php';
  95      if ($returnid == '')
  96      {
  97          $goto = 'moduleinterface.php';
  98      }
  99      $link = '<a href="'.$goto.'?module='.$modinstance->GetName().'&amp;'.$id.'returnid='.$id.$returnid.'&amp;'.$id.'action=' . $action .'&amp;'.$id.'page=';
 100      if ($inline)
 101      {
 102          $link .= '&amp;'.$config['query_var'].'='.$returnid;
 103      }
 104      $page_string = "";
 105      $from = ($page * $limit) - $limit;
 106      $numofpages = floor($totalrows / $limit);
 107      if ($numofpages * $limit < $totalrows)
 108      {
 109          $numofpages++;
 110      }
 111  
 112      if ($numofpages > 1)
 113      {
 114          if($page != 1)
 115          {
 116              $pageprev = $page-1;
 117              $page_string .= $link.$pageprev."\">".lang('previous')."</a>&nbsp;";
 118          }
 119          else
 120          {
 121              $page_string .= lang('previous')." ";
 122          }
 123  
 124          for($i = 1; $i <= $numofpages; $i++)
 125          {
 126              if($i == $page)
 127              {
 128                   $page_string .= $i."&nbsp;";
 129              }
 130              else
 131              {
 132                   $page_string .= $link.$i."\">$i</a>&nbsp;";
 133              }
 134          }
 135  
 136          if (($totalrows - ($limit * $page)) > 0)
 137          {
 138              $pagenext = $page+1;
 139              $page_string .= $link.$pagenext."\">".lang('next')."</a>";
 140          }
 141          else
 142          {
 143              $page_string .= lang('next')." ";
 144          }
 145      }
 146  
 147      return $page_string;
 148  }
 149  
 150  ?>


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