mosDBTable Class Reference

Inheritance diagram for mosDBTable:

aliroDBGeneralRow

List of all members.

Public Member Functions

 mosDBTable ($table='', $keyname='id')
 __call ($method, $args)
 filter ($ignoreList=null)
 getError ()
 get ($_property)
 set ($_property, $_value)
 reset ($value=null)
 hit ($keyvalue=null)
 save ($source, $order_filter)
 publish_array ($cid=null, $publish=1, $myid=0)
 publish ($cid=null, $publish=1, $user_id=0)
 toXML ($mapKeysToText=false)

Public Attributes

 $_tbl = ''
 $_tbl_key = ''

Protected Member Functions

 __get ($name)

Protected Attributes

 $DBclass = 'aliroDatabase'
 $tableName = ''
 $rowKey = ''


Detailed Description

Definition at line 172 of file aliroDatabaseRow.php.


Member Function Documentation

mosDBTable::mosDBTable ( table = '',
keyname = 'id' 
)

Definition at line 179 of file aliroDatabaseRow.php.

00179                                                           {
00180         $this->_tbl = $this->tableName = $table;
00181         $this->_tbl_key = $this->rowKey = $keyname;
00182     }

mosDBTable::__call ( method,
args 
)

Definition at line 184 of file aliroDatabaseRow.php.

References T_().

00184                                      {
00185         if ('mosDBTable' == $method) {
00186             call_user_func_array(array($this, '__construct'), $args);
00187         }
00188         else trigger_error(T_('Invalid method call to mosDBTable'));
00189     }

mosDBTable::__get ( name  )  [protected]

Definition at line 191 of file aliroDatabaseRow.php.

00191                                      {
00192         if ($name == '_db') return call_user_func (array($this->DBclass, 'getInstance'));
00193         else return null;
00194     }

mosDBTable::filter ( ignoreList = null  ) 

Definition at line 196 of file aliroDatabaseRow.php.

References aliroDBGeneralRow::getDatabase(), and aliroRequest::getInstance().

00196                                         {
00197         $request = aliroRequest::getInstance();
00198         foreach ($this->getDatabase()->getAllFieldNames($this->tableName) as $k) {
00199             if (!is_array($ignoreList) OR !in_array($k, $ignoreList)) {
00200                 $this->$k = $request->doPurify($this->$k);
00201             }
00202         }
00203     }

mosDBTable::getError (  ) 

Definition at line 205 of file aliroDatabaseRow.php.

00205                         {
00206         return $this->_error;
00207     }

mosDBTable::get ( _property  ) 

Definition at line 209 of file aliroDatabaseRow.php.

00209                                {
00210         return isset($this->$_property) ? $this->$_property :null;
00211     }

mosDBTable::set ( _property,
_value 
)

Definition at line 213 of file aliroDatabaseRow.php.

00213                                         {
00214         $this->$_property = $_value;
00215     }

mosDBTable::reset ( value = null  ) 

Definition at line 217 of file aliroDatabaseRow.php.

References aliroDBGeneralRow::getDatabase().

00217                                  {
00218         foreach ($this->getDatabase()->getAllFieldNames($this->tableName) as $k) $this->$k = $value;
00219     }

mosDBTable::hit ( keyvalue = null  ) 

Definition at line 221 of file aliroDatabaseRow.php.

References aliroDBGeneralRow::getDatabase(), and aliroRequest::getInstance().

00221                                    {
00222         $k = $this->rowKey;
00223         if (null !== $keyvalue) $this->$k = intval($keyvalue);
00224         $this->getDatabase()->doSQL( "UPDATE $this->tableName SET hits=(hits+1) WHERE $this->rowKey='{$this->$k}'" );
00225 
00226         if (aliroRequest::getInstance()->getCfg('enable_log_items')) {
00227             $now = date( "Y-m-d" );
00228             $this->getDatabase()->doSQL("INSERT INTO #__core_log_items VALUES"
00229                 ."\n ('$now','$this->tableName','".$this->$k."','1')"
00230                 ."\n ON DUPLICATE KEY UPDATE hits=(hits+1)");
00231         }
00232     }

mosDBTable::save ( source,
order_filter 
)

Definition at line 234 of file aliroDatabaseRow.php.

References aliroDBGeneralRow::bind(), aliroDBGeneralRow::check(), aliroDBGeneralRow::checkin(), aliroDBGeneralRow::store(), and aliroDBGeneralRow::updateOrder().

00234                                             {
00235         if (!$this->bind($source) OR !$this->check() OR !$this->store()OR !$this->checkin()) return false;
00236         $this->updateOrder( ($order_filter AND !empty($this->$order_filter)) ? "`$order_filter`='{$this->getDatabase()->getEscaped($this->$order_filter)}'" : "" );
00237         $this->_error = '';
00238         return true;
00239     }

mosDBTable::publish_array ( cid = null,
publish = 1,
myid = 0 
)

Definition at line 241 of file aliroDatabaseRow.php.

References aliroDBGeneralRow::getDatabase().

Referenced by publish().

00241                                                              {
00242         if (!is_array( $cid ) OR count( $cid ) < 1) {
00243             $this->_error = "No items selected.";
00244             return false;
00245         }
00246         foreach ($cid as $i=>$id) $cid[$i] = intval($id);
00247         $cids = implode( ',', $cid );
00248         $publish = $publish ? 1 : 0;
00249         $myid = intval($myid);
00250         $this->getDatabase()->doSQL( "UPDATE $this->tableName SET published=$publish"
00251         . "\nWHERE $this->rowKey IN ($cids) AND (checked_out=0 OR checked_out=$myid)"
00252         );
00253         return true;
00254     }

mosDBTable::publish ( cid = null,
publish = 1,
user_id = 0 
)

Definition at line 256 of file aliroDatabaseRow.php.

References publish_array().

00256                                                           {
00257         $this->publish_array($cid, $publish, $myid);
00258     }

mosDBTable::toXML ( mapKeysToText = false  ) 

Definition at line 260 of file aliroDatabaseRow.php.

References aliroDBGeneralRow::getDatabase().

00260                                            {
00261         if ($mapKeysToText) $attrib = ' mapkeystotext="true"';
00262         $middle = '';
00263         foreach ($this->getDatabase()->getAllFieldNames($this->tableName) as $k) {
00264             $v = $this->$k;
00265             if (is_null($v) OR is_array($v) OR is_object($v) OR (is_string($v) AND '_' == $v[0])) continue;
00266             $middle .= "<$k><![CDATA[$v]]></$k>";
00267         }
00268         return <<<TO_XML
00269 <record table="$this->tableName"$attrib>
00270 $middle
00271 </record>
00272 TO_XML;
00273 
00274     }


Member Data Documentation

mosDBTable::$DBclass = 'aliroDatabase' [protected]

Definition at line 173 of file aliroDatabaseRow.php.

mosDBTable::$_tbl = ''

Definition at line 174 of file aliroDatabaseRow.php.

mosDBTable::$_tbl_key = ''

Definition at line 175 of file aliroDatabaseRow.php.

mosDBTable::$tableName = '' [protected]

Definition at line 176 of file aliroDatabaseRow.php.

mosDBTable::$rowKey = '' [protected]

Definition at line 177 of file aliroDatabaseRow.php.


The documentation for this class was generated from the following file:

Generated on Wed May 14 13:02:01 2008 for ALIRO by  doxygen 1.5.5