CMS_grandFather::raiseError('User has no users management rights ...'); $view->show(); } //load user if any if (sensitiveIO::isPositiveInteger($userId)) { $user = CMS_profile_usersCatalog::getByID($userId); if (!$user || $user->hasError()) { CMS_grandFather::raiseError('Unknown user for given Id : ' . $userId); $view->show(); } } else { //create new user $user = new CMS_profile_user(); } //Contact Data $contactData = $user->getContactData(); //is it a personal profile edition ? $personalProfile = $user->getUserId() == $cms_user->getUserId(); //MAIN TAB //load languages $languages = CMS_languagesCatalog::getAllLanguages(); $languagesDatas = array(); foreach ($languages as $language) { $languagesDatas[] = array('id' => $language->getCode(), 'label' => $language->getLabel()); } $languagesDatas = sensitiveIO::jsonEncode($languagesDatas); //Need to sanitize all datas which can contain single quotes $fullname = sensitiveIO::sanitizeJSString($user->getFullName()); $firstname = sensitiveIO::sanitizeJSString($user->getFirstName()); $lastname = sensitiveIO::sanitizeJSString($user->getLastName()); $lastnameValue = $lastname ? "value:'{$lastname}'," : '';
/** * Get by user : returns the contact data for given user * * @param array $data : datas from DB (loaded by CMS_profile_user) or CMS_profile_user object * @return CMS_contactData * @access public */ static function getByUser($data) { if (is_array($data)) { return CMS_contactDatas_catalog::getById($data); } elseif (is_a($data, 'CMS_profile_user')) { //ugly method but need it for compatibility //I do not think that it is very often useful, so ... $user = new CMS_profile_user($data->getUserID()); return $user->getContactData(); } else { return null; } }