Example #1
0
 public function __construct($id = false)
 {
     parent::__construct();
     if ($id !== false) {
         $this->findById($id);
     }
 }
 public function __construct($group_id = false)
 {
     parent::__construct();
     if (intval($group_id)) {
         $this->findById(intval($group_id));
     }
 }
Example #3
0
 public function __construct($post_id = false)
 {
     parent::__construct();
     if (intval($post_id)) {
         $this->findByPostId(intval($post_id));
     }
 }
Example #4
0
 public function __construct($id = null)
 {
     parent::__construct();
     if ($id) {
         $this->findById(intval($id));
     }
 }
Example #5
0
 public function __construct($note_id = false)
 {
     parent::__construct();
     if (intval($note_id)) {
         $return = $this->findById(intval($note_id));
     }
 }
 /**
  * @param bool $messageId
  */
 public function __construct($messageId = false)
 {
     parent::__construct();
     if ($messageId) {
         $this->findById($messageId);
     }
 }
Example #7
0
 public function __construct($privilege_id = false)
 {
     parent::__construct();
     if (intval($privilege_id)) {
         $this->findById($privilege_id);
     }
 }
Example #8
0
 public function __construct($thread_id = false)
 {
     parent::__construct();
     if (intval($thread_id)) {
         $this->findByThreadId(intval($thread_id));
     }
 }
Example #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;
 }
Example #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();
 }
Example #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;
 }
Example #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;
 }
 /**
  * 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;
 }
Example #14
0
 public function init($values, $dao)
 {
     parent::init($values, $dao);
 }
 public function __construct()
 {
     parent::__construct();
 }
Example #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;
 }
Example #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);
     }
 }
Example #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;
 }