function getMenusToHide($userid) { $jsmodel = XiptFactory::getInstance('jstoolbar', 'model'); $pID = XiptLibProfiletypes::getUserData($userid, 'PROFILETYPE'); $query = new XiptQuery(); $menuids = $query->select('menuid')->from('#__xipt_jstoolbar')->where(" `profiletype` = {$pID} ")->dbLoadQuery("", "")->loadResultArray(); if (empty($menuids)) { return false; } foreach ($menuids as $menuid) { $result = $jsmodel->getMenu($menuid); $hideMenu = XiptRoute::_("{$result->link}"); ob_start(); ?> joms.jQuery(document).ready(function(){ var menuUrl = "<?php echo $hideMenu; ?> ".replace(/\&\;/gi, "&"); joms.jQuery("a[href='" + menuUrl + "']").hide(); }); <?php $content = ob_get_contents(); ob_clean(); JFactory::getDocument()->addScriptDeclaration($content); } }
function getProfileTypes($aid) { if (isset($this->_ptypes[$aid])) { return $this->_ptypes[$aid]; } $query = new XiptQuery(); return $this->_ptypes[$aid] = $query->select('profiletype')->from('#__xipt_applications')->where(" `applicationid` = {$aid} ")->dbLoadQuery("", "")->loadResultArray(); }
function getProfileTypes($menuid) { if (isset($this->_ptypes[$menuid])) { return $this->_ptypes[$menuid]; } $query = new XiptQuery(); return $this->_ptypes[$menuid] = $query->select('profiletype')->from('#__xipt_jstoolbar')->where(" `menuid` = {$menuid} ")->dbLoadQuery("", "")->loadResultArray(); }
static function getPluginStatus($plugin) { $query = new XiptQuery(); if (XIPT_JOOMLA_15) { return $query->select('*')->from('#__plugins')->where(" `element` = '{$plugin}' ")->dbLoadQuery("", "")->loadObject(); } else { return $query->select('*')->from('#__extensions')->where(" `element` = '{$plugin}' ")->dbLoadQuery("", "")->loadObject(); } }
function getModule($modId = 0) { $query = new XiptQuery(); $query->select('*'); $query->from('#__modules'); $query->where("`id` = {$modId}"); $module = $query->dbLoadQuery("", "")->loadObject(); return $module; }
function getGroups($id = '') { $query = new XiptQuery(); $query->select(' `id`, `name` ')->from('#__community_groups'); if (!empty($id)) { $query->where(" `id` = {$id} "); } return $query->dbLoadQuery("", "")->loadObjectList(); /* TODO : what if group list is empty */ }
function getFeatureCounts($resourceAccesser, $catId) { if ($catId) { $condition = "AND `categoryid`= {$catId}"; } else { $condition = ''; } $query = new XiptQuery(); return $query->select('COUNT(*)')->from('#__community_groups')->where(" `ownerid` = {$resourceAccesser} {$condition} ")->dbLoadQuery("", "")->loadResult(); }
function getFieldId($fieldcode) { static $results = array(); $reset = XiptLibJomsocial::cleanStaticCache(); if (isset($results[$fieldcode]) && $reset == false) { return $results[$fieldcode]['id']; } $query = new XiptQuery(); $results = $query->select('*')->from('#__community_fields')->dbLoadQuery()->loadAssocList('fieldcode'); if (array_key_exists($fieldcode, $results)) { return $results[$fieldcode]['id']; } }
function getJUserTypes() { $values = array(JOOMLA_USER_TYPE_NONE); $query = new XiptQuery(); if (XIPT_JOOMLA_15) { $val = $query->select('*')->from('#__core_acl_aro_groups')->where(" `name` <> 'ROOT' ", 'AND')->where(" `name` <> 'USERS' ", 'AND')->where(" `name` <> 'Public Frontend' ", 'AND')->where(" `name` <> 'Public Backend' ", 'AND')->where(" `name` <> 'Super Administrator' ", 'AND')->where(" `name` <> 'Administrator' ", 'AND')->dbLoadQuery("", "")->loadObjectList('name'); } else { $val = $query->select('*')->from('#__usergroups')->dbLoadQuery("", "")->loadObjectList('title'); } if ($val) { return array_merge($values, array_keys($val)); } return $values; }
function getPluginId($element, $folder = 'community') { $reset = XiptLibJomsocial::cleanStaticCache(); static $plugin = null; if ($plugin == null || !isset($plugin[$folder]) || $reset) { $query = new XiptQuery(); if (XIPT_JOOMLA_15) { $plugin[$folder] = $query->select('*')->from('#__plugins')->where(" `folder` = '{$folder}' ")->dbLoadQuery("", "")->loadObjectList('element'); } else { $plugin[$folder] = $query->select('*')->from('#__extensions')->where(" `folder` = '{$folder}' ")->dbLoadQuery("", "")->loadObjectList('element'); } } if (isset($plugin[$folder][$element])) { if (XIPT_JOOMLA_15) { return $plugin[$folder][$element]->id; } else { return $plugin[$folder][$element]->extension_id; } } else { return false; } }
function getAllModules($published = '') { $query = new XiptQuery(); $query->select('*'); $query->from('#__modules'); $query->where("`published` = {$published}"); $query->order('ordering'); $modules = $query->dbLoadQuery("", "")->loadObjectList(); return $modules; }
function getJomsocialProfileFields($filter = '', $join = 'AND') { $query = new XiptQuery(); $query->select('*'); $query->from('#__community_fields'); //setting up the search condition is there is any if (!empty($filter)) { foreach ($filter as $column => $value) { $query->where(" `{$column}` = '{$value}' ", $join); } } $query->order('ordering'); $fields = $query->dbLoadQuery("", "")->loadObjectList(); return $fields; }
function getFeatureCounts($resourceAccesser, $resourceOwner, $otherptype, $aclSelfPtype) { $query = new XiptQuery(); return $query->select('COUNT(*)')->from('#__community_videos')->where(" `creator` = {$resourceAccesser} ", 'AND')->where(" `published` = '1' ", 'AND')->where(" `status` = 'ready' ")->dbLoadQuery("", "")->loadResult(); }
public function getTotalUsers($pid) { $query = new XiptQuery(); return $query->select('count(1)')->from('#__xipt_users')->where("`profiletype` = {$pid}")->dbLoadQuery("", "")->loadResult(); }
/** * check for the row if already exists, according to promary key * * @access public * @param int primary key * @return null|string null if successful otherwise returns and error message */ function isRowExists($pk) { $query = new XiptQuery(); return $query->select('*')->from($this->getTableName())->where(" `{$this->getKeyName()}` = {$pk} ")->dbLoadQuery("", "")->loadObject(); }
function getownerId($id) { $query = new XiptQuery(); return $query->select('creator')->from('#__community_photos')->where(" `id` = {$id} ")->dbLoadQuery("", "")->loadResult(); }
function delete($oid, $glue = 'AND') { //if its a pk, then simple call parent if (is_array($oid) === false) { return parent::delete($oid); } // if an array/ means not a primiary key //Support multiple key-value pair in $oid //rather then deleting on behalf of key only if (empty($oid) || count($oid) <= 0) { return false; } $query = new XiptQuery(); $query->delete()->from($this->getTableName()); foreach ($oid as $key => $value) { $query->where(" `{$key}` = '{$value}' ", $glue); } // XITODO : generate warning if record does not exists return $query->dbLoadQuery("", "")->query(); }
function _isMemberOfGroup($userid, $groupid) { $query = new XiptQuery(); $result = $query->select('memberid')->from('#__community_groups_members')->where(" memberid = {$userid} ", 'AND')->where(" groupid IN ( {$groupid} ) ")->limit(1)->dbLoadQuery()->loadResult(); return $result ? true : false; }
function resetUserAvatar($pid, $newavatar, $oldavatar, $newavatarthumb) { //get all users for profiletype $users = XiptLibProfiletypes::getAllUsers($pid); //Change all avatar and thumb path in url formate $newavatar = XiptHelperUtils::getUrlpathFromFilePath($newavatar); $newavatarthumb = XiptHelperUtils::getUrlpathFromFilePath($newavatarthumb); $cnt = count($users); for ($i = 0; $i < $cnt; $i++) { //if user is admin unset value if (XiptHelperUtils::isAdmin($users[$i])) { unset($users[$i]); } } $users = array_values($users); $cnt = count($users); if ($cnt > 0) { // XITODO : Change IN query to sub query //update user avatar and thumb of all users who doesn't have custom avatar $query = new XiptQuery(); $result = $query->update('#__community_users')->set(" avatar = '{$newavatar}' ")->set(" thumb = '{$newavatarthumb}' ")->where(" avatar = '{$oldavatar}' ")->where(" userid IN (" . implode(",", $users) . ") ")->dbLoadQuery()->query(); if (!$result) { return XiptError::raiseWarning(500, XiptText::_("ERROR_IN_DATABASE_WHEN_SAVING_AVATAR_IN_COMMUNITY_USER_TABLE")); } return true; } }
function getFeatureCounts($resourceAccesser, $resourceOwner, $otherptype, $aclSelfPtype) { $query = new XiptQuery(); return $query->select('COUNT(*)')->from('#__community_photos_albums')->where(" `creator` = {$resourceAccesser} ")->dbLoadQuery("", "")->loadResult(); }
function disableCustomFields() { $query = new XiptQuery(); return $query->update('#__community_fields')->set(" `published` = 0 ")->where(" `type` = 'profiletypes' ", 'OR')->where(" `type` = 'templates' ", 'OR')->dbLoadQuery("", "")->query(); }
function getCategoryId($groupid) { $query = new XiptQuery(); return $query->select('categoryid')->from('#__community_groups')->where("`id` = {$groupid}")->dbLoadQuery("", "")->loadResult(); }
function isFriend($userId, $viewUserId) { $query = new XiptQuery(); return $query->select('connection_id')->from('#__community_connection')->where(" connect_from = {$userId} ", 'AND')->where(" connect_to = {$viewUserId} ", 'AND')->where(" status = 1 ")->dbLoadQuery()->loadResult(); }
public static function getPlan($planid) { $query = new XiptQuery(); $result = $query->select('*')->from('#__acctexp_plans')->dbLoadQuery()->loadObjectList('id'); if (!isset($result[$planid])) { return null; } return $result[$planid]; }
function _switchFieldState($state) { $query = new XiptQuery(); return $query->update('#__community_fields')->set(" published = '{$state}' ")->where(" type = 'profiletypes' ", 'OR')->where(" type = 'templates' ")->dbLoadQuery()->query(); }
function getXiptApps() { $query = new XiptQuery(); return $query->select('*')->from('#__payplans_app')->where(" `type` = 'xiprofiletype' ")->dbLoadQuery("", "")->loadResult(); }