[ Index ]
 

Code source de CMS made simple 1.0.5

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

title

Body

[fermer]

/plugins/ -> function.print.php (source)

   1  <?php
   2  #CMS - CMS Made Simple
   3  #(c)2004 by Ted Kulp (wishy@users.sf.net)
   4  #This project's homepage is: http://cmsmadesimple.sf.net
   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  function smarty_cms_function_print($params, &$smarty)
  20  {
  21      global $gCms;
  22      $page_url = ''; // Initialize var to prevent errors on preview
  23      $text = 'Print This Page';
  24  
  25      if (!empty($params['text']))
  26      {
  27          $text = $params['text'];
  28      }
  29  
  30      $js = '';
  31      if (!empty($params['script']) and $params['script'])
  32      {
  33          $js = '&amp;js=1';
  34      }
  35  
  36          $class = 'noprint';
  37          if (!empty($params['class']) and $params['class'])
  38          {
  39            $class = $params['class'];
  40          }
  41  
  42      $target = '';
  43      if (!empty($params['popup']) and $params['popup'])
  44      {
  45          $target = ' target="_blank"';
  46          $goback = '&amp;goback=0';
  47      }
  48      else
  49      {
  50          $goback = '&amp;goback=0';
  51          if (!empty($params['goback']) and $params['goback'])
  52          {
  53          $goback = '&amp;goback=1';
  54          }
  55      }
  56      if (true == $gCms->config['assume_mod_rewrite'])
  57      {
  58          $hm =& $gCms->GetHierarchyManager();
  59          $curnode =& $hm->getNodeById($gCms->variables['content_id']);
  60          if (isset($curnode))
  61          {
  62              $curcontent =& $curnode->GetContent();
  63                          $page_url = $curcontent->GetURL().'?print=true';
  64          }
  65      }
  66      else
  67      {
  68          $page_url = $gCms->config['root_url'].'/index.php?'.$gCms->config['query_var'].'='.$gCms->variables['content_id'].'&amp;print=true';
  69      }
  70  
  71      //will this work if using htaccess? (Yes! -Wishy)
  72      $output = '<a class="'. $class .'" href="' . $page_url . $goback . $js . '"'. $target . '>';
  73      if (isset($params['showbutton']))
  74      {
  75          $output .= '<img src="'.$gCms->config['root_url'].'/images/cms/printbutton.gif" title="'.$text.'" alt="'.$text.'"/>';
  76      }
  77      else
  78      {
  79          $output .=  $text;
  80      }
  81      return $output.'</a>';
  82  }
  83  
  84  function smarty_cms_help_function_print() {
  85      ?>
  86      <h3>What does this do?</h3>
  87      <p>Creates a link to only the content of the page.</p>
  88      <h3>How do I use it?</h3>
  89      <p>Just insert the tag into your template/page like: <code>{print}</code><br></p>
  90          <h3>What parameters does it take?</h3>
  91          <ul>
  92                  <li><em>(optional)</em> goback - Set to "true" to show a "Go Back" link on the page to print.</li>
  93                  <li><em>(optional)</em> popup - Set to "true" and page for printing will by opened in new window.</li>
  94                  <li><em>(optional)</em> script - Set to "true" and in print page will by used java script for run print of page.</li>
  95                  <li><em>(optional)</em> showbutton - Set to "true" and will show a printer graphic instead of a text link.</li>
  96                  <li><em>(optional)</em> class - class for the link, defaults to "noprint".</li>
  97                  <li><em>(optional)</em> text - Text to use instead of "Print This Page" for the print link.
  98                      <p>Example:</p>
  99                       <pre>{print text="Printable Page"}</pre>      
 100                       </li>
 101          </ul>
 102      <?php
 103  }
 104  
 105  function smarty_cms_about_function_print() {
 106      ?>
 107      <p>Author: Brett Batie&lt;brett-cms@classicwebdevelopment.com&gt;</p>
 108      <p>Version: 1.0</p>
 109      <p>
 110      Change History:<br/>
 111      1.1 - Modified to customize print page (roman)
 112      </p>
 113      <?php
 114  }
 115  
 116  ?>


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