/** * If this object constructed with a valid Id then load from the DB * @return boolean TRUE on success, FALSE on failure - mErrors will contain reason for failure */ public function load() { if ($this->verifyId($this->mId) || $this->verifyId($this->mContentId)) { $lookupColumn = $this->verifyId($this->mId) ? $this->mChildIdName : 'content_id'; $bindVars = array(); $selectSql = $joinSql = $whereSql = ''; array_push($bindVars, $lookupId = @BitBase::verifyId($this->mId) ? $this->mId : $this->mContentId); $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars); $query = "\n\t\t\t\tSELECT data.*, lc.*,\n\t\t\t\t\tuue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name,\n\t\t\t\t\tuuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name\n\t\t\t\t\t{$selectSql}\n\t\t\t\tFROM `" . $this->mFormTbl . "` data\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON (lc.`content_id` = data.`content_id`)\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uue ON (uue.`user_id` = lc.`modifier_user_id`)\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON (uuc.`user_id` = lc.`user_id`)\n\t\t\t\t\t{$joinSql}\n\t\t\t\tWHERE (data.`{$lookupColumn}` = ?)\n\t\t\t\t\t{$whereSql}"; $result = $this->mDb->query($query, $bindVars); if ($result && $result->numRows()) { $this->mInfo = $result->fields; $this->mContentId = $result->fields['content_id']; $this->mId = $result->fields[$this->mChildIdName]; $this->mInfo['creator'] = !empty($result->fields['creator_real_name']) ? $result->fields['creator_real_name'] : $result->fields['creator_user']; $this->mInfo['editor'] = !empty($result->fields['modifier_real_name']) ? $result->fields['modifier_real_name'] : $result->fields['modifier_user']; $this->mInfo['display_name'] = BitUser::getTitle($this->mInfo); $this->mInfo['display_url'] = $this->getDisplayUrl(); $this->mInfo['edit_url'] = $this->getEditUrl(); $this->mInfo['remove_url'] = $this->getRemoveUrl(); $this->mInfo['parsed_data'] = $this->parseData(); parent::load(); } } return count($this->mInfo); }