b2evolution PHP Cross Reference Blogging Systems

Source: /inc/sessions/model/_internal_searches.class.php - 149 lines - 3235 bytes - Summary - Text - Print

Description: This file implements the Internal search item class. b2evolution - {@link http://b2evolution.net/} Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}

   1  <?php
   2  /**
   3   * This file implements the Internal search item class.
   4   *
   5   * b2evolution - {@link http://b2evolution.net/}
   6   * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
   7   *
   8   * @package admin
   9   *
  10   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  11   * @author fplanque: Francois PLANQUE.
  12   *
  13   * @version $Id: _internal_searches.class.php 3328 2013-03-26 11:44:11Z yura $
  14   */
  15  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  16  
  17  load_class( '_core/model/dataobjects/_dataobject.class.php', 'DataObject' );
  18  
  19  /**
  20   * Internal search item Class
  21   *
  22   * @package evocore
  23   */
  24  class InternalSearches extends DataObject
  25  {
  26      var $keywords = '';
  27      var $name = '';
  28      /**
  29       * @var int
  30       */
  31      var $coll_ID = '';
  32      var $hit_ID = '';
  33  
  34      /**
  35       * Constructor
  36       *
  37       * @param object Database row
  38       */
  39  	function InternalSearches( $db_row = NULL )
  40      {
  41          // Call parent constructor:
  42          parent::DataObject( 'T_logs__internal_searches', 'isrch_', 'isrch_ID' );
  43  
  44           if( $db_row )
  45          {
  46              $this->ID            = $db_row->isrch_ID;
  47              $this->coll_ID       = $db_row->isrch_coll_ID;
  48              $this->hit_ID        = $db_row->isrch_hit_ID;
  49              $this->keywords      = $db_row->isrch_keywords;
  50              
  51          }
  52          else
  53          {    // Create a new internal search item:
  54          }
  55      }
  56  
  57  
  58      /**
  59       * Generate help title text for action
  60       *
  61       * @param string action code: edit, delete, etc.
  62       * @return string translated help string
  63       */
  64  	function get_action_title( $action )
  65      {
  66          switch( $action )
  67          {
  68              case 'edit': return T_('Edit this internal search...');
  69              case 'copy': return T_('Duplicate this internal search...');
  70              case 'delete': return T_('Delete this internal search!');
  71              default:
  72                  return '';
  73          }
  74      }
  75  
  76  
  77      /**
  78       * Check permission on a persona
  79       *
  80       * @todo fp> break up central User::check_perm() so that add-on modules do not need to add code into User class.
  81       *
  82       * @return boolean true if granted
  83       */
  84  	function check_perm( $action= 'view', $assert = true )
  85      {
  86          /**
  87          * @var User
  88          */
  89          global $current_User;
  90  
  91          return $current_User->check_perm( 'stats', $action, $assert );
  92      }
  93  
  94  
  95      /**
  96       * Load data from Request form fields.
  97       *
  98       * @return boolean true if loaded data seems valid.
  99       */
 100  	function load_from_Request()
 101      {
 102          // Coll ID
 103          $this->set_string_from_param( 'coll_ID', true );
 104  
 105          // Hit ID
 106          $this->set_string_from_param( 'hit_ID', true );
 107  
 108          // Keywords :
 109          $this->set_string_from_param( 'keywords' );
 110          
 111          return ! param_errors_detected();
 112      }
 113  
 114  
 115  	function get_keywords()
 116      {
 117          return $this->keywords;
 118      }
 119  
 120  
 121      /**
 122       * Set param value
 123       *
 124       * By default, all values will be considered strings
 125       *
 126       * @param string parameter name
 127       * @param mixed parameter value
 128       * @param boolean true to set to NULL if empty value
 129       * @return boolean true, if a value has been set; false if it has not changed
 130       */
 131  	function set( $parname, $parvalue, $make_null = false )
 132      {
 133          switch( $parname )
 134          {
 135              case 'coll_ID':
 136                  return $this->set_param( $parname, 'number', $parvalue, true );
 137                  
 138              case 'hit_ID':
 139                  return $this->set_param( $parname, 'number', $parvalue, true );
 140  
 141              case 'keywords':
 142              default:
 143                  return $this->set_param( $parname, 'string', $parvalue, $make_null );
 144          }
 145      }
 146      
 147  }
 148  
 149  ?>

title

Description

title

Description

title

Description

title

title

Body