Ejemplo n.º 1
0
 public function __construct($id = false)
 {
     parent::__construct();
     if ($id !== false) {
         $this->findById($id);
     }
 }
Ejemplo n.º 2
0
 public function __construct($group_id = false)
 {
     parent::__construct();
     if (intval($group_id)) {
         $this->findById(intval($group_id));
     }
 }
Ejemplo n.º 3
0
 public function __construct($post_id = false)
 {
     parent::__construct();
     if (intval($post_id)) {
         $this->findByPostId(intval($post_id));
     }
 }
Ejemplo n.º 4
0
 public function __construct($id = null)
 {
     parent::__construct();
     if ($id) {
         $this->findById(intval($id));
     }
 }
Ejemplo n.º 5
0
 public function __construct($note_id = false)
 {
     parent::__construct();
     if (intval($note_id)) {
         $return = $this->findById(intval($note_id));
     }
 }
Ejemplo n.º 6
0
 /**
  * @param bool $messageId
  */
 public function __construct($messageId = false)
 {
     parent::__construct();
     if ($messageId) {
         $this->findById($messageId);
     }
 }
Ejemplo n.º 7
0
 public function __construct($privilege_id = false)
 {
     parent::__construct();
     if (intval($privilege_id)) {
         $this->findById($privilege_id);
     }
 }
Ejemplo n.º 8
0
 public function __construct($thread_id = false)
 {
     parent::__construct();
     if (intval($thread_id)) {
         $this->findByThreadId(intval($thread_id));
     }
 }
Ejemplo n.º 9
0
 public function __construct($location_id = false)
 {
     parent::__construct();
     if (intval($location_id)) {
         $this->findById(intval($location_id));
     }
     $this->parentId = 0;
     $this->countryId = 0;
 }
Ejemplo n.º 10
0
 /**
  * loads a usage entity on instantiation if provided with an id
  * also loads all usage types from GeoType
  *
  * @param int $id
  * @access public
  */
 public function __construct($id = false)
 {
     parent::__construct();
     if (intval($id)) {
         $this->findById(intval($id));
     }
     $this->createEntity('GeoType');
     $this->geo_types = GeoType::getAllTypes();
 }
Ejemplo n.º 11
0
 protected function loadEntity(array $data)
 {
     if ($status = parent::loadEntity($data)) {
         // get latest post timestamp (if any)
         $query = "SELECT UNIX_TIMESTAMP(MAX( p.create_time )) AS ts\nFROM groups AS g, forums_threads AS t, forums_posts AS p\nWHERE g.id = " . $this->id . "\nAND g.id = t.IdGroup\nAND t.last_postid = p.id";
         if ($result = $this->dao->query($query)) {
             $timestamp = $result->fetch(PDB::FETCH_OBJ);
             $this->latestPost = $timestamp->ts;
         } else {
             $this->latestPost = 0;
         }
     }
     return $status;
 }
Ejemplo n.º 12
0
 /**
  * overloads RoxEntityBase::insert
  *
  * @access public
  * @return int
  */
 public function insert()
 {
     $status = parent::insert();
     if ($status) {
         if (count($this->organizers) > 0) {
             // add organizers to activitiesattendees table
             foreach ($this->organizers as $organizer) {
                 $query = "INSERT INTO activitiesattendees SET activityId = " . $this->id;
                 $query .= ", attendeeId=" . $organizer['attendeeId'];
                 $query .= ", organizer=1, status=1";
                 $this->dao->query($query);
             }
         }
     }
     return $status;
 }
Ejemplo n.º 13
0
 /**
  * overloads RoxEntityBase::loadEntity to load related data
  *
  * @param array $data
  *
  * @access protected
  * @return bool
  */
 protected function loadEntity(array $data)
 {
     if ($status = parent::loadEntity($data)) {
         $entityFactory = new RoxEntityFactory();
         $this->creator = $entityFactory->create('Member', $this->createdBy);
         if ($this->modifiedBy) {
             $this->modifier = $entityFactory->create('Member', $this->modifiedBy);
         }
         if ($this->deletedBy) {
             $this->deleter = $entityFactory->create('Member', $this->deletedBy);
         }
         if ($this->mutuallyExclusiveWith) {
             if ($this->mutuallyExclusiveWith == 'None') {
                 $this->mutuallyExclusive = array();
             } else {
                 $this->mutuallyExclusive = explode(',', $this->mutuallyExclusiveWith);
             }
         } else {
             $this->mutuallyExclusive = 'All';
         }
         // fetch rank votes for this option
         $query = "\n                SELECT\n                    SUM(vote) as sumVotes\n                FROM\n                    suggestions_option_ranks\n                WHERE\n                    optionid = " . $this->id . "\n                GROUP BY\n                    optionid\n                ";
         $this->rankVotes = 0;
         $sql = $this->dao->query($query);
         if ($sql) {
             $row = $sql->fetch(PDB::FETCH_OBJ);
             if ($row) {
                 $this->rankVotes = $row->sumVotes;
             }
         }
         // if member already ranked on this option get that as well
         $member = $this->getLoggedInMember();
         if ($member) {
             $hash = hash_hmac('sha256', $member->id, $this->id);
             $query = "SELECT vote FROM suggestions_option_ranks WHERE optionid = " . $this->id . " AND memberHash = '" . $hash . "'";
             $sql = $this->dao->query($query);
             if ($sql) {
                 $row = $sql->fetch(PDB::FETCH_OBJ);
                 if ($row) {
                     $this->vote = $row->vote;
                 }
             }
         }
     }
     return $status;
 }
Ejemplo n.º 14
0
 public function init($values, $dao)
 {
     parent::init($values, $dao);
 }
Ejemplo n.º 15
0
 public function __construct()
 {
     parent::__construct();
 }
Ejemplo n.º 16
0
 /**
  * overloads RoxEntityBase::loadEntity to load related data
  *
  * @param array $data
  *
  * @access protected
  * @return bool
  */
 protected function loadEntity(array $data)
 {
     if ($status = parent::loadEntity($data)) {
     }
     return $status;
 }
Ejemplo n.º 17
0
 public function update($status = false)
 {
     if ($status) {
         $this->laststatechanged = date('Y-m-d');
         switch ($this->state) {
             case SuggestionsModel::SUGGESTIONS_VOTING:
                 $this->notifyVotingStarted();
                 break;
             case SuggestionsModel::SUGGESTIONS_RANKING:
                 $this->calculateResults();
                 // $this->state = SuggestionsModel::SUGGESTIONS_VOTING;
                 break;
         }
         return parent::update();
     } else {
         // update all fields except for the status field
         // as this might have changed in the mean time
         $query = "\n                UPDATE\n                    suggestions\n                SET\n                    summary = '" . $this->dao->escape($this->summary) . "',\n                    description = '" . $this->dao->escape($this->description) . "',\n                    modified = NOW(),";
         // Check if flags is set and ensure correct value
         if ($this->flags) {
             $query .= " `flags` = " . $this->dao->escape($this->flags);
         } else {
             $query .= " `flags` = 0";
         }
         $query .= ",\n                    modifiedby = " . $this->getLoggedInMember()->id . "\n                WHERE\n                    id = " . $this->id;
         $this->dao->query($query);
     }
 }
Ejemplo n.º 18
0
 /**
  * overloads RoxEntityBase::delete
  *
  * @access public
  * @return int
  */
 public function delete()
 {
     $id = $this->getPKValue();
     if ($status = parent::delete()) {
         $status = !!$this->dao->query("DELETE FROM blog_data WHERE blog_id = {$id}");
     }
     return $status;
 }