Exemplo n.º 1
0
 /**
  * Load messages from the database
  * @param 	object 	$criteria 	{@link icms_db_criteria_Element} object
  * @param 	bool 	$id_as_key 	use ID as key into the array?
  * @return 	array	Array of {@link icms_data_privmessage_Object} objects
  **/
 public function getObjects($criteria = null, $id_as_key = false)
 {
     $ret = array();
     $limit = $start = 0;
     $sql = 'SELECT * FROM ' . $this->db->prefix('priv_msgs');
     if (isset($criteria) && is_subclass_of($criteria, 'icms_db_criteria_Element')) {
         $sql .= ' ' . $criteria->renderWhere();
         $sort = !in_array($criteria->getSort(), array('msg_id', 'msg_time', 'from_userid')) ? 'msg_id' : $criteria->getSort();
         $sql .= ' ORDER BY ' . $sort . ' ' . $criteria->getOrder();
         $limit = $criteria->getLimit();
         $start = $criteria->getStart();
     }
     $result = $this->db->query($sql, $limit, $start);
     if (!$result) {
         return $ret;
     }
     while ($myrow = $this->db->fetchArray($result)) {
         $pm = new icms_data_privmessage_Object();
         $pm->assignVars($myrow);
         if (!$id_as_key) {
             $ret[] =& $pm;
         } else {
             $ret[$myrow['msg_id']] =& $pm;
         }
         unset($pm);
     }
     return $ret;
 }
Exemplo n.º 2
0
 /**
  * constructor
  **/
 function XoopsPrivmessage()
 {
     parent::__construct();
     $this->_deprecated = icms_core_Debug::setDeprecated('icms_data_privmessage_Object', sprintf(_CORE_REMOVE_IN_VERSION, '1.4'));
 }