[ Index ]

PHP Cross Reference of phpwcms V1.5.0 _r431 (28.01.12)

title

Body

[close]

/include/inc_lib/ -> article.functions.inc.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2012 Oliver Georgi <oliver@phpwcms.de> // All rights reserved.
   6   
   7     This script is part of PHPWCMS. The PHPWCMS web content management system is
   8     free software; you can redistribute it and/or modify it under the terms of
   9     the GNU General Public License as published by the Free Software Foundation;
  10     either version 2 of the License, or (at your option) any later version.
  11    
  12     The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
  13     A copy is found in the textfile GPL.txt and important notices to the license 
  14     from the author is found in LICENSE.txt distributed with these scripts.
  15    
  16     This script is distributed in the hope that it will be useful, but WITHOUT ANY 
  17     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  18     PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  19   
  20     This copyright notice MUST APPEAR in all copies of the script!
  21  *************************************************************************************/
  22  
  23  
  24  //Baut das Level Struktur Auswahlmenü
  25  function struct_select_menu($counter=0, $struct_id=0, $selected_id=0, $return='option') {
  26  
  27      $struct_id        = intval($struct_id);
  28      $selected_id    = intval($selected_id);
  29      $counter        = intval($counter) + 1;
  30      
  31      if($return=='array') {
  32          $structure = array();        
  33      }
  34                      
  35      $sql = "SELECT acat_id, acat_name FROM ".DB_PREPEND."phpwcms_articlecat WHERE acat_trash=0 AND acat_struct=".$struct_id." ORDER BY acat_sort";
  36      if($result = mysql_query($sql, $GLOBALS['db']) or die ("error while building struct select menu (ID:".$struct_id)) {
  37          $sx=0;
  38          while($row = mysql_fetch_assoc($result)) {
  39              $row['acat_name'] = str_repeat('-', $counter) . ' ' . $row['acat_name'];
  40              $struct[$sx] = $row;
  41              $sx++;
  42          }
  43          mysql_free_result($result);
  44      }
  45      
  46      if(isset($struct[0])) {
  47          foreach($struct as $value) {
  48              if($return=='array') {
  49                  
  50                  $structure[$value["acat_id"]] = $value["acat_name"];
  51                  
  52                  $substruct = struct_select_menu($counter, $value["acat_id"], 0, 'array');
  53                  
  54                  if(count($substruct)) {
  55                      $structure += $substruct;
  56                  }
  57                  
  58              } else {
  59                  
  60                  echo "<option value=\"".$value["acat_id"]."\"";
  61                  echo ( ($selected_id==$value["acat_id"]) ? " selected" : "" ).">";
  62                  echo html_entities($value["acat_name"]);
  63                  echo "</option>\n";
  64                  struct_select_menu($counter, $value["acat_id"], $selected_id, 'option');
  65              
  66              }
  67          }
  68      }
  69      
  70      if($return=='array') {
  71          return $structure;        
  72      }
  73  }
  74  
  75  function change_articledate($article_id=0) {
  76      // update article date when content part was changed
  77      $article_id = intval($article_id);
  78      if($article_id) {
  79          $sql  = "UPDATE ".DB_PREPEND."phpwcms_article SET ";
  80          $sql .= "article_tstamp = NOW() WHERE article_id = '".$article_id."' LIMIT 1 ;";
  81          mysql_query($sql, $GLOBALS['db']);
  82      }
  83  }
  84  
  85  function struct_select_list($counter=0, $struct_id=0, & $selected_id) {
  86  
  87      global $db;
  88  
  89      $struct_id        = intval($struct_id);
  90      $counter        = intval($counter) + 1;
  91                      
  92      $sql = "SELECT * FROM ".DB_PREPEND."phpwcms_articlecat WHERE acat_trash=0 AND acat_struct=".$struct_id." ORDER BY acat_sort;";
  93      if($result = mysql_query($sql, $db) or die ("error while building struct select menu (ID:".$struct_id)) {
  94          $sx=0;
  95          while($row = mysql_fetch_assoc($result)) {
  96              $struct[$sx] = $row;
  97              $sx++;
  98          }
  99          mysql_free_result($result);
 100      }
 101      if(isset($struct[0])) {
 102          foreach($struct as $key => $value) {
 103              echo '<option value="'.$struct[$key]["acat_id"].'"';
 104              if(in_array($struct[$key]["acat_id"], $selected_id)) {
 105                  echo ' selected';
 106              }
 107              echo '>'.str_repeat("&#8212;", $counter).' '.html_specialchars($struct[$key]["acat_name"]);
 108              echo '</option>'.LF;
 109              struct_select_list($counter, $struct[$key]["acat_id"], $selected_id);
 110          }
 111      }
 112  }
 113  
 114  ?>


Generated: Sun Jan 29 16:31:14 2012 Cross-referenced by PHPXref 0.7.1