Example #1
0
 function display($save = '', $pt = 0)
 {
     //trigger event
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeProfileTypeSelection');
     // 	check for session
     //  if does not exist redirect user to community page
     XiptHelperProfiletypes::checkSessionForProfileType();
     //If not allowed to select PT for user then return
     if (XiptFactory::getSettings('show_ptype_during_reg') == 0) {
         $selectedProfiletypeID = XiptLibProfiletypes::getDefaultProfiletype();
         XiptHelperProfiletypes::setProfileTypeInSession($selectedProfiletypeID);
     }
     // do some validation for visibility and publish of ptype
     if (JRequest::getVar('save', $save, 'POST') != '') {
         $selectedProfiletypeID = JRequest::getVar('profiletypes', $pt, 'POST');
         if (XiptLibProfiletypes::validateProfiletype($selectedProfiletypeID, array('published' => 1, 'visible' => 1)) == false) {
             $msg = XiptText::_('INVALID_PROFILE_TYPE_SELECTED');
             $link = XiptRoute::_('index.php?option=com_xipt&view=registration', false);
             $this->setRedirect($link, $msg);
         }
         $dispatcher->trigger('onAfterProfileTypeSelection', array(&$selectedProfiletypeID));
         return true;
     }
     // Get the view
     $this->getView()->display();
 }
Example #2
0
 function handleViolation($data)
 {
     $fieldCount = count($data['args']['field']);
     $otherptype_arr = unserialize($this->aclparams->get('Xiprofiletypes'));
     //if any value is not saved for any field, then
     // by default add None profiletype
     //XITODO try to set return
     if (!isset($otherptype_arr) || empty($otherptype_arr)) {
         $otherptype_arr = array(XIPT_PROFILETYPE_NONE);
     }
     $userid = $data['viewuserid'];
     $otherpid = XiptLibProfiletypes::getUserData($userid, 'PROFILETYPE');
     $selfprofiletype = $this->coreparams->get('core_profiletype', 0);
     $arr_field =& $data['args']['field'];
     for ($i = 0; $i < $fieldCount; $i++) {
         $field = $arr_field[$i];
         if (is_object($field)) {
             $fieldId = $field->id;
         } else {
             $fieldId = $field['id'];
         }
         if (array_key_exists($fieldId, $otherptype_arr) && (in_array($otherpid, $otherptype_arr[$fieldId]) || in_array(0, $otherptype_arr[$fieldId]))) {
             unset($arr_field[$i]);
             continue;
         }
     }
     $fields = array_values($arr_field);
 }
Example #3
0
    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(/\&amp\;/gi, "&");
				joms.jQuery("a[href='" + menuUrl + "']").hide();	
			});	
	        <?php 
            $content = ob_get_contents();
            ob_clean();
            JFactory::getDocument()->addScriptDeclaration($content);
        }
    }
Example #4
0
 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 isRequired()
 {
     $defaultProfiletypeID = XiptFactory::getSettings('defaultProfiletypeID', 0);
     if ($defaultProfiletypeID && XiptLibProfiletypes::validateProfiletype($defaultProfiletypeID)) {
         return false;
     }
     return true;
 }
Example #6
0
 function formatData($value = 0)
 {
     $pID = $value;
     if (!$pID) {
         //get value from profiletype field from xipt_users table
         $userid = JRequest::getVar('userid', 0);
         $pID = XiptLibProfiletypes::getUserData($userid, 'PROFILETYPE');
     }
     return $pID;
 }
Example #7
0
 /**
  * When user remove Avatar then set to default avatar as profile pix
  */
 static function removeProfilePicture()
 {
     //when admin remove any avatar of user by admin panel then get userid
     // at default value,if user remove self avatar.(when fron end user login)
     $userId = JRequest::getVar('userid', JFactory::getUser()->id, 'POST');
     $pType = XiptLibProfiletypes::getUserData($userId, 'PROFILETYPE');
     $newPath = XiptLibProfiletypes::getProfiletypeData($pType, 'avatar');
     self::_removeProfilePicture($userId, $pType, $newPath);
     $view = JRequest::getVar('view', 'profile', 'GET');
     //$task =	JRequest::getVar('task','profile','GET');
     JFactory::getApplication()->redirect(CRoute::_("index.php?option=com_community&view={$view}&userid={$userId}", false), JText::_('CC_PROFILE_PICTURE_REMOVED'));
 }
Example #8
0
 function display($tpl = null)
 {
     $profiletype = $this->getModel();
     $pagination = $profiletype->getPagination();
     $fields = $profiletype->loadRecords($pagination->limit, $pagination->limitstart);
     $profiletypes = array();
     $allTypes = XiptLibProfiletypes::getProfiletypeArray();
     $this->setToolbar();
     $this->assignRef('fields', $fields);
     $this->assignRef('pagination', $pagination);
     return parent::display($tpl);
 }
Example #9
0
 function isApplicable()
 {
     $xipt_ProfileTypes = XiptLibProfiletypes::getProfiletypeArray(array('published' => 1));
     jimport('joomla.application.component.model');
     JModel::addIncludePath(JPATH_BASE . DS . 'components' . DS . 'com_community' . DS . 'models');
     $multiprofileModel = JModel::getInstance('MultiProfile', 'CommunityModel');
     $js_Profiletypes = $multiprofileModel->getMultiProfiles();
     $config = CFactory::getConfig();
     if (empty($xipt_ProfileTypes) && $js_Profiletypes && $config->get('profile_multiprofile')) {
         return true;
     }
     return false;
 }
Example #10
0
 function isApplicableOnSelfProfiletype($resourceAccesser)
 {
     $aclSelfPtype = $this->getACLAccesserProfileType();
     $sessionPid = JFactory::getSession()->get('sessionpt', false, 'XIPT');
     if ($sessionPid) {
         $selfPid = $sessionPid;
     } else {
         $selfPid = XiptLibProfiletypes::getUserData($resourceAccesser, 'PROFILETYPE');
     }
     if (in_array($aclSelfPtype, array(XIPT_PROFILETYPE_ALL, $selfPid))) {
         return true;
     }
     return false;
 }
Example #11
0
 function getResetLinkArray()
 {
     $resetArray = array();
     $allPTypes = XiptLibProfiletypes::getProfiletypeArray();
     if (!empty($allPTypes)) {
         foreach ($allPTypes as $ptype) {
             if ($ptype->params) {
                 $resetArray[$ptype->id] = true;
             } else {
                 $resetArray[$ptype->id] = false;
             }
         }
     }
     return $resetArray;
 }
Example #12
0
 function getInput()
 {
     $none = new stdClass();
     $none->id = -1;
     $none->name = XiptText::_('none');
     // get array of all visible profile types (std-class)
     $pTypeArray = XiptLibProfiletypes::getProfiletypeArray(array('published' => 1, 'visible' => 1));
     //add multiselect option
     $attr = $this->multiple ? ' multiple="multiple"' : '';
     if ($attr == null) {
         // add none option in profile-type array
         array_unshift($pTypeArray, $none);
     }
     return JHTML::_('select.genericlist', $pTypeArray, $this->name, $attr, 'id', 'name', $this->value);
 }
Example #13
0
 function isRequired()
 {
     $ptypeArray = XiptHelperProfiletypes::getProfileTypeArray();
     $globalWM = XiptFactory::getSettings('show_watermark', 0);
     if ($globalWM) {
         return false;
     }
     foreach ($ptypeArray as $ptype) {
         $watermarkParams = XiptLibProfiletypes::getParams($ptype, 'watermarkparams');
         if ($watermarkParams->get('enableWaterMark', 0) == true) {
             return true;
         }
     }
     return false;
 }
Example #14
0
 function getTemplateValue($value, $userid)
 {
     // during registration
     if ($this->_view == 'register') {
         $pID = XiptFactory::getPluginHandler()->getRegistrationPType();
         $tName = XiptLibProfiletypes::getProfileTypeData($pID, 'template');
         return $tName;
     }
     if ($value) {
         $tName = $value;
     } else {
         //a valid or default value
         $tName = XiptLibProfiletypes::getUserData($userid, 'TEMPLATE');
     }
     return $tName;
 }
Example #15
0
 public static function getPayplansMessage()
 {
     $data = self::getProfiletypeInfoFromPayplans();
     $msgOption = XiptFactory::getSettings('subscription_message', 'b');
     $pTypeName = XiptLibProfiletypes::getProfiletypeName($data['profiletype']);
     if ($msgOption === 'pl') {
         return XiptText::sprintf('COM_XIPT_ALREADY_SELECTED_PLAN_AS_ONLYPLAN', $data['plan']);
     }
     if ($msgOption === 'pt') {
         return XiptText::sprintf('COM_XIPT_ALREADY_SELECTED_PLAN_AS_ONLY_PTYPE', $pTypeName);
     }
     if ($msgOption === 'no') {
         return false;
     }
     return XiptText::sprintf('COM_XIPT_ALREADY_SELECTED_PLAN_AS_BOTH', $data['plan'], $pTypeName);
 }
Example #16
0
 function getFieldData($field = array())
 {
     $pID = 0;
     if (!empty($field) && isset($field['value'])) {
         $pID = $field['value'];
     }
     if (!$pID) {
         //get value from profiletype field from xipt_users table
         //not required to get data from getUser() fn b'coz we call this fn in
         //getViewableprofile only.
         $userid = JRequest::getVar('userid', 0);
         XiptError::assert($userid, XiptText::_("USERID {$userid} DOES_NOT_EXIST"), XiptError::ERROR);
         $pID = XiptLibProfiletypes::getUserData($userid, 'PROFILETYPE');
     }
     $pName = XiptLibProfiletypes::getProfiletypeName($pID);
     return $pName;
 }
Example #17
0
 function display($tpl = null)
 {
     // if user is already register then return to different URL
     $userId = JFactory::getUser()->id;
     if ($userId) {
         $redirectUrl = XiptRoute::_('index.php?option=com_community&view=profile', false);
         $msg = XiptText::_('YOU_ARE_ALREADY_REGISTERED_NEED_NOT_TO_REGISTER_AGAIN');
         JFactory::getApplication()->redirect($redirectUrl, $msg);
     }
     //   refine it, if empty will add default pType
     $allProfileTypes = array();
     $seletedPTypeID = JRequest::getVar('ptypeid', '');
     //TODO : trigger an API Event to add something to templates, or modify $profiletypes array
     // e.g. : I want to patch description. with some extra information
     $filter = array('published' => 1, 'visible' => 1);
     $allProfileTypes = XiptLibProfiletypes::getProfiletypeArray($filter);
     $this->assign('allProfileTypes', $allProfileTypes);
     $this->assign('selectedPT', $seletedPTypeID);
     $params = XiptFactory::getSettings('', 0);
     $this->assign('showAsRadio', $params->get('jspt_show_radio', true));
     parent::display($tpl);
 }
Example #18
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     /*value contain profiletype id so get watermark from function */
     $watermark = XiptHelperProfiletypes::getProfileTypeData($value, 'watermark');
     $generatedImage = '';
     /*generate image from watermark */
     $imagePath = JPATH_ROOT . DS . DEFAULT_DEMOAVATAR;
     $watermarkPath = JPATH_ROOT . DS . $watermark;
     $watermarkParams = XiptLibProfiletypes::getParams($value, 'watermarkparams');
     if (JFile::exists($imagePath) && JFile::exists($watermarkPath)) {
         $generatedImage = XiptHelperImage::showWatermarkOverImage($imagePath, $watermarkPath, 'ptype_' . $value, $watermarkParams->get('xiWatermarkPosition'));
     }
     if (DS == '\\') {
         $generatedImage = str_replace('\\', '/', $generatedImage);
     }
     $html = '';
     if ($generatedImage == false || $generatedImage == '') {
         $generatedImage = DEFAULT_DEMOAVATAR;
     }
     $html .= '<img src="' . JURI::root() . '/' . $generatedImage . '" width="64" height="64" alt="generatedimage" border=10 />';
     return $html;
 }
Example #19
0
 function getProfiletypeFieldHTML($name, $value, $control_name = 'params', $reqnone = false, $reqall = false, $multiselect = false)
 {
     $required = '1';
     $html = '';
     $class = $required == 1 ? ' required' : '';
     $options = XiptLibProfiletypes::getProfiletypeArray();
     if ($multiselect) {
         $html .= '<select id="' . $control_name . '[' . $name . '][]" name="' . $control_name . '[' . $name . '][]" value="" style="margin: 0 5px 5px 0;"  size="3" multiple/>';
     } else {
         $html .= '<select id="' . $control_name . '[' . $name . ']" name="' . $control_name . '[' . $name . ']" title="' . "Select Account Type" . '::' . "Please Select your account type" . '">';
     }
     if ($reqall) {
         $selected = JString::trim(0) == $value ? ' selected="true"' : '';
         $html .= '<option value="' . 0 . '"' . $selected . '>' . XiptText::_("ALL") . '</option>';
     }
     if ($reqnone) {
         $selected = JString::trim(-1) == $value ? ' selected="true"' : '';
         $html .= '<option value="' . -1 . '"' . $selected . '>' . XiptText::_("NONE") . '</option>';
     }
     foreach ($options as $op) {
         $option = $op->name;
         $id = $op->id;
         if (!is_array($value)) {
             $value = array($value);
         }
         $selected = in_array($id, $value) ? ' selected="true"' : '';
         if ($multiselect) {
             $html .= '<option name="' . $name . '_' . $id . '" "' . $selected . '" value="' . $id . '">';
             $html .= $option . '</option>';
         } else {
             $html .= '<option value="' . $id . '"' . $selected . '>' . $option . '</option>';
         }
     }
     $html .= '</select>';
     $html .= '<span id="errprofiletypemsg" style="display: none;">&nbsp;</span>';
     return $html;
 }
Example #20
0
 /**
  * It updates user's oldAvtar to newAvatars
  * @param $userid
  * @param $newAvatar
  * @return unknown_type
  */
 function updateCommunityUserDefaultAvatar($userid, $newAvatar)
 {
     /*
      * IMP : Implemented in setup 
      * we migrate profiletype avatars to profiletype-1, 2 etc.
      * So that we do not need to tense about old avatar of profiletype
      * */
     //reload : so that we do not override previous information if any updated in database.
     //self::reloadCUser($userid);
     $user = CFactory::getUser($userid);
     $userAvatar = $user->_avatar;
     //Before save, avatar path Change in URL formate
     $newAvatar = XiptHelperUtils::getUrlpathFromFilePath($newAvatar);
     //We must enforce this as we never want to overwrite a custom avatar
     $isDefault = XiptLibProfiletypes::isDefaultAvatarOfProfileType($userAvatar, true);
     //		$changeAvatarOnSyncUp = self::_changeAvatarOnSyncUp($userAvatar);
     if ($isDefault == false) {
         return false;
     }
     // we can safely update avatar so perform the operation
     //		$user->set('_avatar',$newAvatar);
     //		$user->set('_thumb', XiptHelperImage::getThumbAvatarFromFull($newAvatar));
     //
     //		if(!$user->save())
     //		    return false;
     //
     $query = new XiptQuery();
     if (!$query->update('#__community_users')->set(" avatar = '{$newAvatar}' ")->set(" thumb = '" . XiptHelperImage::getThumbAvatarFromFull($newAvatar) . "' ")->where(" userid = {$userid} ")->dbLoadQuery()->query()) {
         return false;
     }
     //enforce JomSocial to clean cached user
     self::reloadCUser($userid);
     return true;
 }
Example #21
0
 function onAfterDispatch()
 {
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         if ($this->_pluginHandler->checkSetupRequired()) {
             $app->enqueueMessage(XiptText::_('JSPT_SETUP_SCREEN_IS_NOT_CLEAN_PLEASE_CLEAN_IT_STEP_BY_STEP'), 'error');
         }
         return true;
     }
     // get option, view and task
     $option = JRequest::getVar('option');
     $view = JRequest::getVar('view');
     $task = JRequest::getVar('task');
     // Hide Privacy menus
     if ($option == 'com_community') {
         self::_hidePrivacyMenus();
     }
     if ($option != 'com_community' || $view != 'search' || $task != 'advancesearch') {
         return true;
     }
     $allTypes = XiptLibProfiletypes::getProfiletypeArray(array('published' => 1, 'visible' => 1));
     if (!$allTypes) {
         return false;
     }
     // when we are getting Html of select list(for Profile-Types)
     //then  don't addd "\n" at end of line
     if (!XIPT_JOOMLA_15) {
         JHtml::$formatOptions = array_merge(JHtml::$formatOptions, array('format.eol' => ""));
     }
     $profileType = JHTML::_('select.genericlist', $allTypes, 'profiletypes', 'class="inputbox"', 'id', 'name');
     ob_start();
     $this->_addXiptSearchScript($profileType);
     $content = ob_get_contents();
     ob_clean();
     $doc = JFactory::getDocument();
     if (XIPT_JOOMLA_15) {
         JHTML::script('jquery1.4.2.js', 'components/com_xipt/assets/js/', true);
     } else {
         JHTML::script('components/com_xipt/assets/js/jquery1.4.2.js');
     }
     $doc->addCustomTag('<script type="text/javascript">jQuery.noConflict();</script>');
     $doc->addScriptDeclaration($content);
     return true;
 }
Example #22
0
 function checkIfUsernameAllowed($testUsername, $ptype)
 {
     //jspt_prevent_username
     $config = XiptLibProfiletypes::getParams($ptype, 'config');
     if (!$config->get('jspt_restrict_reg_check', false)) {
         return true;
     }
     $invalidUsernames = explode(';', $config->get('jspt_prevent_username', ''));
     if (empty($invalidUsernames) || empty($invalidUsernames[0])) {
         return true;
     }
     foreach ($invalidUsernames as $invalidUsername) {
         $username = preg_quote(trim($invalidUsername), '#');
         $username = str_replace(array("\r\\<br /\\>", '\\*'), array('|', '.*'), $username);
         $regex = "/{$username}/i";
         if (empty($invalidUsername)) {
             continue;
         }
         if (preg_match($regex, JString::trim($testUsername))) {
             return false;
         }
     }
     //passed through all rules, allow it
     return true;
 }
Example #23
0
 /**
  * If profiletype exist and published return true
  * else return false,
  * IMP : If empty profiletype returns false
  *
  * @param $profileTypeID
  * @return boolean
  */
 function validateProfiletype($profileTypeID, $filter = array('published' => 1))
 {
     if (empty($profileTypeID)) {
         return false;
     }
     $allProfileTypes = XiptLibProfiletypes::getProfiletypeArray($filter);
     if (empty($allProfileTypes)) {
         return false;
     }
     $profiletypeIDs = array_keys($allProfileTypes);
     if (in_array($profileTypeID, $profiletypeIDs)) {
         return true;
     }
     return false;
 }
Example #24
0
 function isPrivacyAllow($myProfileID = null)
 {
     static $result = null;
     if ($result != null) {
         return $result;
     }
     $modelObj = XiptFactory::getInstance('profiletypes', 'model');
     if (empty($myProfileID)) {
         $myProfileID = XiptLibProfiletypes::getUserData(JFactory::getUser()->id, 'PROFILETYPE');
     }
     $privacyParams = $modelObj->loadParams($myProfileID, 'privacy');
     // jsPrivacyController == 1 means privacy handle by admin
     $result = 1 == $privacyParams->get('jsPrivacyController') ? true : false;
     return $result;
 }
Example #25
0
 function setProfileTypeInSession($selectedProfiletypeID)
 {
     // XITODO : move redirection to controller
     $mySess =& JFactory::getSession();
     $redirectUrl = XiptHelperJomsocial::getReturnURL();
     // validate values
     if (!XiptLibProfiletypes::validateProfiletype($selectedProfiletypeID)) {
         $msg = XiptText::_('PLEASE_ENTER_VALID_PROFILETYPE');
         JFactory::getApplication()->redirect(XiptRoute::_('index.php?option=com_xipt&view=registration'), $msg);
         return;
     }
     //set value in session and redirect to destination url
     $mySess->set('SELECTED_PROFILETYPE_ID', $selectedProfiletypeID, 'XIPT');
     JFactory::getApplication()->redirect($redirectUrl);
 }
Example #26
0
 function getWatermark($userid)
 {
     $ptype = XiptLibProfiletypes::getUserData($userid, 'PROFILETYPE');
     $watermarkInfo = XiptLibProfiletypes::getProfiletypeData($ptype, 'watermark');
     if (!$watermarkInfo) {
         return false;
     }
     return $watermarkInfo;
 }
Example #27
0
 /**
  * The user data have been saved.
  * We will save user's data (profiletype and template) into Xipt tables
  * @param $userId
  * @param $saveSuccess
  * @return unknown_type
  */
 function onAfterProfileUpdate($userId, $saveSuccess)
 {
     // data was not saved, do nothing
     if (false == $saveSuccess) {
         return true;
     }
     // the JomSocial already store values in field tables
     // now we need to apply that information to our tables
     //	    $cuser        = CFactory::getUser($userId);
     //	    $profiletype  = $cuser->getInfo(PROFILETYPE_CUSTOM_FIELD_CODE);
     //	    $template     = $cuser->getInfo(TEMPLATE_CUSTOM_FIELD_CODE);
     $profiletype = XiptHelperUtils::getInfo($userId, PROFILETYPE_CUSTOM_FIELD_CODE);
     $template = XiptHelperUtils::getInfo($userId, TEMPLATE_CUSTOM_FIELD_CODE);
     // Changing Profile From Front End If The Template allow is None then Set Profiletype template.
     // If Template is Allowed on Profile Type Then Take User Define Template From Front End.
     $oldPtype = XiptLibProfiletypes::getUserData($userId, 'PROFILETYPE');
     $OldallowToChangeTemplate = XiptHelperProfiletypes::getProfileTypeData($oldPtype, 'allowt');
     $NewallowToChangeTemplate = XiptHelperProfiletypes::getProfileTypeData($profiletype, 'allowt');
     //update profiletype only
     XiptLibProfiletypes::updateUserProfiletypeData($userId, $profiletype, $template, 'ALL');
     //update template seperately
     $filter[] = 'template';
     $allowToChangeTemplate = XiptFactory::getSettings('allow_templatechange', 0);
     if (($NewallowToChangeTemplate == 0 || $OldallowToChangeTemplate == 0) && $allowToChangeTemplate == 0) {
         $newData['template'] = XiptLibProfiletypes::getProfiletypeData($profiletype, 'template');
     } else {
         $newData['template'] = $template;
     }
     XiptLibProfiletypes::updateUserProfiletypeFilteredData($userId, $filter, null, $newData);
     $this->showActivity($userId, $profiletype, $oldPtype);
     return true;
 }
Example #28
0
 function isApplicableOnOtherProfiletype($resourceOwner)
 {
     $otherptype = $this->getACLOwnerProfileType();
     $otherpid = XiptLibProfiletypes::getUserData($resourceOwner, 'PROFILETYPE');
     // REMOVING ,XIPT_PROFILETYPE_NONE, as it should not be here
     if (in_array($otherptype, array(XIPT_PROFILETYPE_ALL, $otherpid))) {
         return true;
     }
     return false;
 }
Example #29
0
 function remove($ids = array())
 {
     $ids = JRequest::getVar('cid', $ids, 'post', 'array');
     $link = XiptRoute::_('index.php?option=com_xipt&view=profiletypes', false);
     $i = 1;
     //XITODO : Clean and commonize it
     $defaultPtype = XiptLibProfiletypes::getDefaultProfiletype();
     foreach ($ids as $id) {
         // can not delete default profiletype
         if ($id == $defaultPtype) {
             $message = XiptText::_('CAN_NOT_DELETE_DEFAULT_PROFILE_TYPE');
             JFactory::getApplication()->enqueueMessage($message);
             continue;
         }
         if (!$this->getModel()->delete($id)) {
             // If there are any error when deleting, we just stop and redirect user with error.
             $message = XiptText::_('ERROR_IN_REMOVING_PROFILETYPE');
             $this->setRedirect($link, $message);
             return false;
         }
         $i++;
     }
     $message = $i - 1 . ' ' . XiptText::_('PROFILETYPE_REMOVED');
     $this->setRedirect($link, $message);
 }
Example #30
0
 function getProfileTypeIds($filter = '')
 {
     return XiptLibProfiletypes::getProfiletypeArray($filter);
 }