本文整理汇总了PHP中Profile类的典型用法代码示例。如果您正苦于以下问题:PHP Profile类的具体用法?PHP Profile怎么用?PHP Profile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Profile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: createUser
public function createUser(RegistrationForm $form, Profile $profile)
{
$transaction = Yii::app()->db->beginTransaction();
try {
$user = new User('registration');
$data = $form->getAttributes();
unset($data['cPassword'], $data['verifyCode']);
$user->setAttributes($data);
$user->hash = $this->hasher->hashPassword($form->password);
$user->role = User::USER_ROLE;
if ($user->save() && ($token = $this->tokenStorage->createAccountActivationToken($user)) !== false) {
$profile->user_id = $user->id;
if (!$profile->save()) {
throw new CException(Yii::t('UserModule.user', 'Error creating profile!'));
}
Yii::log(Yii::t('UserModule.user', 'Account {nick_name} was created', array('{nick_name}' => $user->email)), CLogger::LEVEL_INFO, UserModule::$logCategory);
//@TODO
Yii::app()->notify->send($user, Yii::t('UserModule.user', 'Registration on {site}', array('{site}' => Yii::app()->getModule('yupe')->siteName)), '//user/email/needAccountActivationEmail', array('token' => $token));
Yii::app()->notify->sendAdmin('Новый пользователь на сайте ' . CHtml::encode(Yii::app()->getModule('yupe')->siteName), '//user/email/newUserEmail', array('user' => $user));
$transaction->commit();
return $user;
}
throw new CException(Yii::t('UserModule.user', 'Error creating account!'));
} catch (Exception $e) {
Yii::log(Yii::t('UserModule.user', 'Error {error} account creating!', array('{error}' => $e->__toString())), CLogger::LEVEL_INFO, UserModule::$logCategory);
$transaction->rollback();
return false;
}
}
开发者ID:kuzmina-mariya,项目名称:gallery,代码行数:29,代码来源:UserManager.php
示例2: getIndex
public function getIndex()
{
$campaign = new Campaign();
$image = $campaign->getCampaignImage();
$users = new Users();
$member = $users->getRecentUsers();
$this->layout->foot = View::make("landing.foot")->with(array('data' => $image, 'data2' => $member));
$this->layout->title = "Welcome to Sagip.ph";
if (Session::has('userid')) {
$username = Session::get('username');
$logstatus = true;
$userid = Session::get('userid');
$profile = new Profile();
$pic = "#";
$result = $profile->getProfile($userid);
if ($result) {
$pic = $result->profilepic;
}
$data = array('username' => $username, 'logstatus' => $logstatus, 'profilepic' => $pic);
$campaign = new Campaign();
$data2 = $campaign->getCampaignHome();
$this->layout->head = View::make("landing.head")->with($data);
$this->layout->body = View::make("landing.bodycontributordash")->with($data);
} else {
$logstatus = false;
$data = array('logstatus' => $logstatus);
$campaign = new Campaign();
$data2 = $campaign->getCampaignHome();
$this->layout->head = View::make("landing.head")->with($data);
$this->layout->body = View::make("landing.bodycontributordash")->with($data);
}
}
开发者ID:centaurustech,项目名称:sagip,代码行数:32,代码来源:ContributorController.php
示例3: createUser
public function createUser(RegistrationForm $form)
{
$transaction = Yii::app()->db->beginTransaction();
try {
$user = new User('registration');
$profile = new Profile('registration');
$data = $form->getAttributes();
// Устанавливаем атрибуты пользователя
$user->setAttributes(array('email' => $data['email']));
// Генерируем для пользователя новый пароль
$password = $this->hasher->generateRandomPassword();
$user->hash = $this->hasher->hashPassword($password);
// Устанавливаем роль пользователя
$user->role = User::USER_ROLE;
$profile->setAttributes(array('name' => $data['name'], 'gender' => $data['gender'], 'birth_date' => $data['date'], 'birth_time' => $form->getTime(), 'city_id' => $data['city_id']));
$profile->subscriber = Profile::SUBSCRIBER_YES;
if ($user->save() && ($token = $this->tokenStorage->createAccountActivationToken($user)) !== false) {
$profile->user_id = $user->id;
if (!$profile->save()) {
throw new CException(Yii::t('UserModule.user', 'Error creating profile!'));
}
$event = new CEvent($this, array('user' => $user, 'password' => $password, 'token' => $token, 'programId' => $data['programId'], 'subscriptionType' => $data['subscriptionType']));
$this->onSuccessRegistration($event);
Yii::log(Yii::t('UserModule.user', 'Account {nick_name} was created', array('{nick_name}' => $user->email)), CLogger::LEVEL_INFO, UserModule::$logCategory);
$transaction->commit();
return $user;
}
throw new CException(Yii::t('UserModule.user', 'Error creating account!'));
} catch (Exception $e) {
Yii::log(Yii::t('UserModule.user', 'Error {error} account creating!', array('{error}' => $e->__toString())), CLogger::LEVEL_INFO, UserModule::$logCategory);
$transaction->rollback();
return false;
}
}
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:34,代码来源:UserManager.php
示例4: plugin_pdf_MassiveActionsProcess
function plugin_pdf_MassiveActionsProcess($data)
{
switch ($data["action"]) {
case "plugin_pdf_DoIt":
foreach ($data['item'] as $key => $val) {
if ($val) {
$tab_id[] = $key;
}
}
$_SESSION["plugin_pdf"]["type"] = $data["itemtype"];
$_SESSION["plugin_pdf"]["tab_id"] = serialize($tab_id);
echo "<script type='text/javascript'>\n location.href='../plugins/pdf/front/export.massive.php'</script>";
break;
case "plugin_pdf_allow":
$profglpi = new Profile();
$prof = new PluginPdfProfile();
foreach ($data['item'] as $key => $val) {
if ($profglpi->getFromDB($key) && $profglpi->fields['interface'] != 'helpdesk') {
if ($prof->getFromDB($key)) {
$prof->update(array('id' => $key, 'use' => $data['use']));
} else {
if ($data['use']) {
$prof->add(array('id' => $key, 'use' => $data['use']));
}
}
}
}
break;
}
}
开发者ID:geldarr,项目名称:hack-space,代码行数:30,代码来源:hook.php
示例5: updateUserUrls
function updateUserUrls()
{
printfnq("Updating user URLs...\n");
// XXX: only update user URLs where out-of-date
$qry = "SELECT * FROM profile order by id asc";
$pflQry = new Profile();
$pflQry->query($qry);
$members = array();
while ($pflQry->fetch()) {
$members[] = clone $pflQry;
}
$pflQry->free();
foreach ($members as $member) {
$user = $member->getUser();
printfv("Updating user {$user->nickname}...");
try {
$profile = $user->getProfile();
updateProfileUrl($profile);
updateAvatarUrls($profile);
// Broadcast for remote users
common_broadcast_profile($profile);
} catch (Exception $e) {
printv("Error updating URLs: " . $e->getMessage());
}
printfv("DONE.");
}
}
开发者ID:Grasia,项目名称:bolotweet,代码行数:27,代码来源:updateurls.php
示例6: aProfile
private function aProfile($pid)
{
$this->caller->requireAuthentication();
require_once FRAMEWORK_PATH . 'models/profile.php';
if ($_SERVER['REQUEST_METHOD'] == 'PUT') {
if ($pid == $this->registry->getObject('authenticate')->getUser()->getUserID()) {
$profile = new Profile($this->registry, $pid);
if ($profile->isValid()) {
$data = $this->caller->getRequestData();
$profile->setName($this->registry->getObject('db')->sanitizeData($data['name']));
$profile->setDinoName($this->registry->getObject('db')->sanitizeData($data['dino_name']));
// etc, set all appropriate methods
$profile->save();
header('HTTP/1.0 204 No Content');
exit;
} else {
header('HTTP/1.0 404 Not Found');
exit;
}
} else {
header('HTTP/1.0 403 Forbidden');
exit;
}
} else {
$profile = new Profile($this->registry, $pid);
if ($profile->isValid()) {
header('HTTP/1.0 200 OK');
echo json_encode($profile->toArray());
exit;
} else {
header('HTTP/1.0 404 Not Found');
exit;
}
}
}
开发者ID:simontakite,项目名称:cookbooks,代码行数:35,代码来源:profiles.php
示例7: update_profile
function update_profile($profile_id, $data)
{
$yes_no = array('YES', 'NO');
$urls = $_SESSION['OCS']['url_service'];
$profiles = get_profiles();
$profile = $profiles[$profile_id];
$updatedProfile = new Profile($profile_id, $data['new_label'] ?: $profile->getLabel());
foreach ($data['restrictions'] as $key => $val) {
$updatedProfile->setRestriction($key, $val);
}
foreach ($data['config'] as $key => $val) {
$updatedProfile->setConfig($key, $val);
}
foreach ($data['blacklist'] as $key => $val) {
if ($val == 'YES') {
$updatedProfile->addToBlacklist($key);
}
}
foreach ($data['pages'] as $key => $val) {
if ($urls->getUrl($key) and $val == 'on') {
$updatedProfile->addPage($key);
}
}
$serializer = new XMLProfileSerializer();
$xml = $serializer->serialize($updatedProfile);
if (file_put_contents(DOCUMENT_REAL_ROOT . '/config/profiles/' . $profile->getName() . '.xml', $xml)) {
return $profile->getName();
} else {
return false;
}
}
开发者ID:remicollet,项目名称:OCSInventory-ocsreports,代码行数:31,代码来源:profile_functions.php
示例8: postIndex
public function postIndex()
{
$input = Input::only('first_name', 'last_name', 'email', 'username', 'password', 'domain_id');
$domain_id = Cookie::get('domain_hash') ? Cookie::get('domain_hash') : 'NULL';
$rules = array('first_name' => 'required|min:1', 'email' => 'required|email|unique:users,email,NULL,id,deleted_at,NULL,domain_id,' . $domain_id, 'username' => 'required|min:3|must_alpha_num|unique:users,username,NULL,id,deleted_at,NULL,domain_id,' . $domain_id, 'password' => 'required|min:6');
$v = Validator::make($input, $rules);
if ($v->fails()) {
return Output::push(array('path' => 'register', 'errors' => $v, 'input' => TRUE));
}
$profile = new Profile(array('first_name' => $input['first_name'], 'last_name' => $input['last_name'], 'website' => ''));
$profile->save();
$user = new User(array('domain_id' => Cookie::get('domain_hash') ? Cookie::get('domain_hash') : NULL, 'email' => $input['email'], 'username' => $input['username'], 'password' => Hash::make($input['password']), 'status' => Cookie::get('domain_hash') ? 4 : 3));
$user->profile()->associate($profile);
$user->save();
if ($user->id) {
if ($user->status == 4) {
$this->add_phone_number($user->id);
}
$cookie = Cookie::forget('rndext');
$confirmation = App::make('email-confirmation');
$confirmation->send($user);
Mail::send('emails.register', array('new_user' => $input['username']), function ($message) {
$message->from(Config::get('mail.from.address'), Config::get('mail.from.name'))->to(Input::get('email'))->subject(_('New user registration'));
});
Event::fire('logger', array(array('account_register', array('id' => $user->id, 'username' => $user->username), 2)));
// return Output::push(array(
// 'path' => 'register',
// 'messages' => array('success' => _('You have registered successfully')),
// ));
return Redirect::to('register')->with('success', _('You have registered successfully'))->withCookie($cookie);
} else {
return Output::push(array('path' => 'register', 'messages' => array('fail' => _('Fail to register')), 'input' => TRUE));
}
}
开发者ID:digideskio,项目名称:voip-id,代码行数:34,代码来源:RegisterController.php
示例9: displayTabContentForItem
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
{
return;
$profile = new Profile();
$found_profiles = $profile->find("`interface` = 'central'");
$tab_profile = new self();
$found_tab_profiles = $tab_profile->find("`plugin_custom_tabs_id` = " . $item->getID());
echo "<form method='POST' action='tabprofile.form.php' />";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='4'>" . __("Visibility") . "</th></tr>";
$odd = 0;
foreach ($found_profiles as $profiles_id => $profile_fields) {
if ($odd % 2 === 0) {
echo "<tr>";
}
echo "<td>" . $profile_fields['name'] . "</td>";
echo "<td>";
Dropdown::showYesNo("tab_profile[{$profiles_id}]", 0);
echo "</td>";
if ($odd % 2 === 1) {
echo "</tr>";
}
$odd++;
}
if ($odd % 2 === 0) {
echo "</tr>";
}
echo "<tr><td colspan='4'><div class='center'>";
echo "<input type='submit' name='update' value=\"" . _sx('button', 'Post') . "\" class='submit'>";
echo "</div></td></tr>";
echo "</table>";
Html::closeForm();
return true;
}
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:34,代码来源:tabprofile.class.php
示例10: getGraders
static function getGraders($groupid)
{
$qry = 'SELECT profile.* ' . 'FROM profile JOIN grades_group ' . 'ON profile.id = grades_group.userid ' . 'WHERE grades_group.groupid = ' . $groupid;
$graders = new Profile();
$graders->query($qry);
return $graders;
}
开发者ID:Grasia,项目名称:bolotweet,代码行数:7,代码来源:Gradesgroup.php
示例11: registerUser
private function registerUser($username, $data = NULL)
{
try {
$gingerKey = sfConfig::get('app_portail_ginger_key');
if ($gingerKey != "abc") {
$ginger = new \Ginger\Client\GingerClient(sfConfig::get('app_portail_ginger_key'));
$cotisants = $ginger->getUser($username);
} else {
$cotisants = new stdClass();
$cotisants->mail = $username . "@etu.utc.fr";
$cotisants->prenom = "Le";
$cotisants->nom = "Testeur";
$cotisants->type = "etu";
}
if (!$data) {
$data = new sfGuardUser();
}
$data->setUsername($username);
$data->setEmailAddress($cotisants->mail);
$data->setFirstName($cotisants->prenom);
$data->setLastName($cotisants->nom);
$data->setIsActive(true);
$data->save();
$profile = new Profile();
$profile->setUser($data);
$profile->setDomain($cotisants->type);
$profile->save();
return $data;
} catch (\Ginger\Client\ApiException $ex) {
$this->setFlash('error', "Il n'a pas été possible de vous identifier. Merci de contacter [email protected] en précisant votre login et le code d'erreur " . $ex->getCode() . ".");
}
return false;
}
开发者ID:TheoJD,项目名称:portail,代码行数:33,代码来源:sfUTCCASUser.class.php
示例12: createUser
/**
* for person create user, assign Customer office role, send Inivation email
* @param int $person_id
* @return boolean
*/
public function createUser($person_id)
{
$m = Person::model();
$model = $m->findByPk($person_id);
//person may be already registred as user
if (!empty($model->user_id)) {
return TRUE;
}
//create user
$password = $this->randomPassword();
$mUser = new User();
$mUser->attributes = array('username' => $model->email, 'password' => UserModule::encrypting($password), 'email' => $model->email, 'superuser' => 0, 'status' => User::STATUS_ACTIVE);
$mUser->activkey = UserModule::encrypting(microtime() . $password);
if (!$mUser->save()) {
return FALSE;
}
//attach user to person
$model->user_id = $mUser->id;
$model->save();
//create user profile
$profile = new Profile();
$profile->user_id = $mUser->id;
$profile->first_name = $model->first_name;
$profile->last_name = $model->last_name;
$profile->save();
unset($profile);
//add Customer office role
Rights::assign(DbrUser::RoleCustomerOffice, $mUser->id);
//send email
Yii::import('vendor.dbrisinajumi.person.components.invitationEmail');
$e = new invitationEmail();
$name = $model->first_name . ' ' . $model->last_name;
$e->sendInvitate($model->email, $password, $model->email, $name);
return true;
}
开发者ID:dbrisinajumi,项目名称:person,代码行数:40,代码来源:Person.php
示例13: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$user = new User();
$profile = new Profile();
// Uncomment the following line if AJAX validation is needed
$this->performAjaxValidation(array($user, $profile));
if (isset($_POST['User'], $_POST['Profile'])) {
// populate input into $model and $profile
$user->attributes = $_POST['User'];
$profile->attributes = $_POST['Profile'];
// validate both $model and $profile
$valid = $user->validate();
$valid = $profile->validate() && $valid;
if ($valid) {
if ($user->save()) {
$profile->user_id = $user->id;
$profile->email = $user->username;
if ($profile->save()) {
$this->redirect(array('view', 'id' => $user->id));
}
}
}
}
$this->render('create', array('user' => $user, 'profile' => $profile));
}
开发者ID:nbayteam,项目名称:project1,代码行数:29,代码来源:UserController.php
示例14: actionRegistration
/**
* Registration user
*/
public function actionRegistration()
{
if(Y::module()->isRegistrationClose) $this->redirect('close');
$model = new RegistrationForm;
$profile=new Profile;
$profile->regMode = true;
// ajax validator
if(isset($_POST['ajax']) && $_POST['ajax']==='registration-form')
Y::end(UActiveForm::validate(array($model,$profile)));
if (Y::userId()) {
$this->redirect(Y::module()->cabinetUrl);
} else {
if(isset($_POST['RegistrationForm'])) {
$model->attributes=$_POST['RegistrationForm'];
$profile->attributes= isset($_POST['Profile'])?$_POST['Profile']:array();
if($model->validate()&&$profile->validate())
{
$soucePassword = $model->password;
$model->activkey=UserModule::encrypting(microtime().$soucePassword);
$model->password=UserModule::encrypting($soucePassword);
$model->verifyPassword=UserModule::encrypting($model->verifyPassword);
$model->createtime=time();
$model->lastvisit=((Y::module()->loginNotActiv||(Y::module()->activeAfterRegister&&Y::module()->sendActivationMail==false))&&Y::module()->autoLogin)?time():0;
$model->superuser=0;
$model->status=((Y::module()->activeAfterRegister)?User::STATUS_ACTIVE:User::STATUS_NOACTIVE);
if ($model->save()) {
$profile->user_id=$model->id;
$profile->save();
if (Y::module()->sendActivationMail) {
$activation_url = $this->createAbsoluteUrl('/user/activation',array("activkey" => $model->activkey, "email" => $model->email));
UserModule::sendMail($model->email,Users::t("You registered from {site_name}",array('{site_name}'=>Yii::app()->name)),Users::t("Please activate you account go to {activation_url}",array('{activation_url}'=>$activation_url)));
}
if ((Y::module()->loginNotActiv||(Y::module()->activeAfterRegister&&Y::module()->sendActivationMail==false))&&Y::module()->autoLogin) {
$identity=new UserIdentity($model->username,$soucePassword);
$identity->authenticate();
Y::user()->login($identity,0);
$this->redirect(Y::module()->returnUrl);
} else {
if (!Y::module()->activeAfterRegister&&!Y::module()->sendActivationMail) {
Y::flash('/user/registration',Users::t("Thank you for your registration. Contact Admin to activate your account."));
} elseif(Y::module()->activeAfterRegister&&Y::module()->sendActivationMail==false) {
Y::flash('/user/registration',Users::t("Thank you for your registration. Please {{login}}.",array('{{login}}'=>CHtml::link(Users::t('Login'),Y::module()->loginUrl))));
} elseif(Y::module()->loginNotActiv) {
Y::flash('/user/registration',Users::t("Thank you for your registration. Please check your email or login."));
} else {
Y::flash('/user/registration',Users::t("Thank you for your registration. Please check your email."));
}
$this->refresh();
}
}
} else $profile->validate();
}
$this->render('/user/registration',array('model'=>$model,'profile'=>$profile,'lang'=>Yii::app()->language));
}
}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:63,代码来源:RegistrationController.php
示例15: profile
function profile()
{
// get the data to save. low on security because the user can only save to himself from here
if ($this->input->post()) {
$this->form_validation->set_rules('display_name', _('Display Name'), 'trim|max_length[30]|xss_clean');
$this->form_validation->set_rules('twitter', _('Twitter username'), 'trim|max_length[20]|xss_clean');
$this->form_validation->set_rules('bio', _('Bio'), 'trim|max_length[140]|xss_clean');
if ($this->form_validation->run()) {
$profile = new Profile($this->tank_auth->get_user_id());
// use the from_array to be sure what's being inputted
$profile->display_name = $this->form_validation->set_value('display_name');
$profile->twitter = $this->form_validation->set_value('twitter');
$profile->bio = $this->form_validation->set_value('bio');
if ($profile->save()) {
$data["saved"] = TRUE;
}
}
}
$user = new User($this->tank_auth->get_user_id());
$profile = new Profile($this->tank_auth->get_user_id());
$data["user_id"] = $user->id;
$data["user_name"] = $user->username;
$data["user_email"] = $user->email;
$data["user_display_name"] = $profile->display_name;
$data["user_twitter"] = $profile->twitter;
$data["user_bio"] = $profile->bio;
$this->viewdata["function_title"] = _("Your profile");
$this->viewdata["main_content_view"] = $this->load->view('account/profile/profile', $data, TRUE);
$this->load->view("account/default.php", $this->viewdata);
}
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:30,代码来源:index.php
示例16: doClean
/**
* @see sfValidatorBase
*/
protected function doClean($values)
{
// only validate if username and password are both present
if (isset($values[$this->getOption('username_field')]) && isset($values[$this->getOption('password_field')])) {
$username = $values[$this->getOption('username_field')];
$password = $values[$this->getOption('password_field')];
// user exists?
if ($user = sfGuardUserPeer::retrieveByUsername($username)) {
// password is ok?
if ($user->getIsActive()) {
if (Configuration::get('ldap_enabled', false)) {
if (authLDAP::checkPassword($username, $password)) {
return array_merge($values, array('user' => $user));
}
} elseif ($user->checkPassword($password)) {
return array_merge($values, array('user' => $user));
}
}
} elseif (Configuration::get('ldap_enabled', false) && Configuration::get('ldap_create_user', false) && authLDAP::checkPassword($username, $password)) {
$user = new sfGuardUser();
$user->setUsername($username);
$user->save();
$profile = new Profile();
$profile->setSfGuardUserId($user->getId());
$profile->save();
return array_merge($values, array('user' => $user));
}
if ($this->getOption('throw_global_error')) {
throw new sfValidatorError($this, 'invalid');
}
throw new sfValidatorErrorSchema($this, array($this->getOption('username_field') => new sfValidatorError($this, 'invalid')));
}
// assume a required error has already been thrown, skip validation
return $values;
}
开发者ID:xfifix,项目名称:Jenkins-Khan,代码行数:38,代码来源:ValidatorUser.class.php
示例17: onEndUserRegister
public function onEndUserRegister(Profile $profile)
{
$profile->sandbox();
if ($this->debug) {
common_log(LOG_WARNING, "AutoSandbox: sandboxed of {$profile->nickname}");
}
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:7,代码来源:AutoSandboxPlugin.php
示例18: showResults
function showResults($q, $page)
{
$profile = new Profile();
$search_engine = $profile->getSearchEngine('profile');
$search_engine->set_sort_mode('chron');
// Ask for an extra to see if there's more.
$search_engine->limit(($page - 1) * PROFILES_PER_PAGE, PROFILES_PER_PAGE + 1);
if (false === $search_engine->query($q)) {
$cnt = 0;
} else {
$cnt = $profile->find();
}
if ($cnt > 0) {
$terms = preg_split('/[\\s,]+/', $q);
$results = new PeopleSearchResults($profile, $terms, $this);
$results->show();
$profile->free();
$this->pagination($page > 1, $cnt > PROFILES_PER_PAGE, $page, 'peoplesearch', array('q' => $q));
} else {
// TRANS: Message on the "People search" page where a query has no results.
$this->element('p', 'error', _('No results.'));
$this->searchSuggestions($q);
$profile->free();
}
}
开发者ID:microcosmx,项目名称:experiments,代码行数:25,代码来源:peoplesearch.php
示例19: showForm
/**
* Configuration form
**/
function showForm($id, $options = array())
{
$target = $this->getFormURL();
if (isset($options['target'])) {
$target = $options['target'];
}
if (!Session::haveRight("profile", "r")) {
return false;
}
$canedit = Session::haveRight("profile", "w");
$prof = new Profile();
if ($id) {
$this->getFromDB($id);
$prof->getFromDB($id);
}
echo "<form action='" . $target . "' method='post'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2' class='center b'>" . sprintf(_('%1$s %2$s'), 'gestion Vip :', Dropdown::getDropdownName("glpi_groups", $this->fields["id"]));
echo "</th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>Groupe Vip</td><td>";
Dropdown::showYesNo("isvip", $this->fields["isvip"]);
echo "</td></tr>";
if ($canedit) {
echo "<tr class='tab_bg_2'>";
echo "<td class='center' colspan='2'>";
echo "<input type='hidden' name='id' value={$id}>";
echo "<input type='submit' name='update_vip_group' value='Mettre à jour' class='submit'>";
echo "</td></tr>";
}
echo "</table>";
Html::closeForm();
}
开发者ID:geldarr,项目名称:hack-space,代码行数:36,代码来源:group.class.php
示例20: showForm
/**
* Show profile form
*
* @param $items_id integer id of the profile
* @param $target value url of target
*
* @return nothing
**/
function showForm($profiles_id = 0, $openform = TRUE, $closeform = TRUE)
{
echo "<div class='firstbloc'>";
if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) {
$profile = new Profile();
echo "<form method='post' action='" . $profile->getFormURL() . "'>";
}
$profile = new Profile();
$profile->getFromDB($profiles_id);
$rights = array(array('itemtype' => 'PluginAddressingAddressing', 'label' => __('Generate reports', 'addressing'), 'field' => 'plugin_addressing'));
$profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('General')));
echo "<table class='tab_cadre_fixehov'>";
$effective_rights = ProfileRight::getProfileRights($profiles_id, array('plugin_addressing_use_ping_in_equipment'));
echo "<tr class='tab_bg_2'>";
echo "<td width='20%'>" . __('Use ping on equipment form', 'addressing') . "</td>";
echo "<td colspan='5'>";
Html::showCheckbox(array('name' => '_plugin_addressing_use_ping_in_equipment[1_0]', 'checked' => $effective_rights['plugin_addressing_use_ping_in_equipment']));
echo "</td></tr>\n";
echo "</table>";
if ($canedit && $closeform) {
echo "<div class='center'>";
echo Html::hidden('id', array('value' => $profiles_id));
echo Html::submit(_sx('button', 'Save'), array('name' => 'update'));
echo "</div>\n";
Html::closeForm();
}
echo "</div>";
}
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:36,代码来源:profile.class.php
注:本文中的Profile类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论