public function hasViewed($objUser) { if (!$objUser) { return true; } $arrView = clsDB::selectQuery("SELECT *\n\t\t\t\t\t\t\t\t\t\tFROM `<<tbl><usercommentview>>`\n\t\t\t\t\t\t\t\t\t\tWHERE `<<foreign><usercommentview><user>>`='" . $objUser->get('id') . "'\n\t\t\t\t\t\t\t\t\t\t\tAND `<<foreign><usercommentview><comment>>`='" . $this->get('id') . "'\n\t\t\t\t\t\t\t\t\t\t\tAND `<<isdel><usercommentview>>`='0'\n\t\t\t\t\t\t\t\t\t\tLIMIT 0, 1 "); return sizeof($arrView); }
/** Checks if the user is an invited member of the group. */ public function isInvitedMember($objUser) { if (!$objUser) { return false; } if ($this->isFounder($objUser)) { return false; } $arrGroups = clsDB::selectQuery("\n\t\t\t\t\t\t\t\t\tSELECT * \n\t\t\t\t\t\t\t\t\t\tFROM `<<tbl><usergroup>>`\n\t\t\t\t\t\t\t\t\t\t\tWHERE `<<foreign><usergroup><group>>`='" . $this->get('id') . "'\n\t\t\t\t\t\t\t\t\t\t\t\tAND `<<foreign><usergroup><user>>`='" . $objUser->get('id') . "'\n\t\t\t\t\t\t\t\t\t\t\t\tAND `<<usergroup><has_accepted>>`='0'\n\t\t\t\t\t\t\t\t\t\t\t\tAND `<<isdel><usergroup>>`='0'\n\t\t\t\t\t\t\t\t\tLIMIT 0, 1\n\t\t\t\t"); return sizeof($arrGroups); }
public function hasNewPictures($objUser) { if (!$objUser) { return false; } if ($this->isEmpty()) { return false; } $arrDB = clsDB::selectQuery("\n\t\t\t\t\tSELECT * \n\t\t\t\t\t\tFROM `<<tbl><picture>>`\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t`<<isdel><picture>>`='0' \n\t\t\t\t\t\t\tAND `<<picture><confirmed>>`='1'\n\t\t\t\t\t\t\tAND `<<foreign><picture><album>>`='" . $this->get('id') . "'\n\t\t\t\t\t\t\tAND `<<picture><id>>` NOT IN\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\tSELECT `<<foreign><userpictureview><picture>>`\n\t\t\t\t\t\t\t\t\t\tFROM `<<tbl><userpictureview>>`\n\t\t\t\t\t\t\t\t\t\tWHERE `<<foreign><userpictureview><user>>`='" . $objUser->get('id') . "'\n\t\t\t\t\t\t\t\t\t\t\tAND `<<isdel><userpictureview>>`='0'\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\tLIMIT 0, 1\n\t\t\t\t\t"); return sizeof($arrDB); }
/** Loads the object from the database, based on the value set in 'id'. All data in the array * is removed. Optionally, an array of which fields to load can be passed. */ public function load($arrFields = null) { $strTable = $this->getName(); $intID = $this->get('id'); if ($arrFields == null || sizeof($arrFields) == 0) { $strFields = '*'; } else { foreach ($arrFields as &$strField) { if (!clsDB::isValidFieldName($strField)) { throw new Exception(ERRORMSG_INVALID); } $strField = "`<<{$strTable}><{$strField}>>`"; } $strFields = implode($arrFields, ','); } $SQL = "SELECT {$strFields} FROM `<<tbl><{$strTable}>>` WHERE `<<{$strTable}><id>>`='{$intID}' AND `<<isdel><{$strTable}>>`='0' LIMIT 0,1;"; $arrResult = clsDB::selectQuery($SQL); $this->clearData(); if (sizeof($arrResult) > 0) { $this->getFromRow($arrResult[0]); } }