当前位置: 首页>>代码示例>>PHP>>正文


PHP Person::model方法代码示例

本文整理汇总了PHP中Person::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Person::model方法的具体用法?PHP Person::model怎么用?PHP Person::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Person的用法示例。


在下文中一共展示了Person::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionStadtraetInnenPersonen

 public function actionStadtraetInnenPersonen()
 {
     if (!$this->binContentAdmin()) {
         $this->errorMessageAndDie(403, "");
     }
     $this->top_menu = "admin";
     if (AntiXSS::isTokenSet("save")) {
         /** @var Person $person */
         $person = Person::model()->findByPk($_REQUEST["person"]);
         if ($person) {
             if (isset($_REQUEST["fraktion"])) {
                 $person->typ = Person::$TYP_FRAKTION;
                 $person->ris_stadtraetIn = null;
             } else {
                 $person->typ = Person::$TYP_PERSON;
                 $person->ris_stadtraetIn = isset($_REQUEST["stadtraetIn"]) ? $_REQUEST["stadtraetIn"] : null;
             }
             $person->save();
         }
         $this->msg_ok = "Gespeichert";
     }
     /** @var Person[] $personen */
     $personen = Person::model()->findAll(["order" => "name"]);
     /** @var StadtraetIn[] $stadtraetInnen */
     $stadtraetInnen = StadtraetIn::model()->findAll(["order" => "name"]);
     $this->render("stadtraetInnenPersonen", ["personen" => $personen, "stadtraetInnen" => $stadtraetInnen]);
 }
开发者ID:CatoTH,项目名称:Muenchen-Transparent,代码行数:27,代码来源:AdminController.php

示例2: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Device();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Device'])) {
         $model->attributes = $_POST['Device'];
         $model->status = 1;
         if (Person::model()->findByPk($model->person_id)->company_id == User::getMyCompany() || Yii::app()->user->role == 1) {
             if ($model->save()) {
                 $fp = fopen('images/barcode/' . $model->barcode . '.png', 'wb');
                 // Открываем файл
                 $ch = curl_init("http://barcode.tec-it.com/barcode.ashx?translate-esc=off&data={$model->barcode}&code=Code128&unit=Fit&dpi=96&imagetype=Png&rotation=0&color=000000&bgcolor=FFFFFF&qunit=Mm&quiet=0");
                 curl_setopt($ch, CURLOPT_FILE, $fp);
                 // Передаём дескриптор файла, туда сбросится результат
                 curl_setopt($ch, CURLOPT_HEADER, 0);
                 curl_exec($ch);
                 curl_close($ch);
                 fclose($fp);
                 //Перечмодим файлик
                 chmod('images/barcode/' . $model->barcode . '.png', 0777);
                 //Теперь мы его обрежем, чтобы не нам не мешал водознак
                 UserFunctions::crop('images/barcode/' . $model->barcode . '.png');
                 $this->redirect(array('view', 'id' => $model->id));
             }
         } else {
             throw new CHttpException(403, 'Вы не имеете прав в этой организации');
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:griffindor,项目名称:new-inventory,代码行数:35,代码来源:DeviceController.php

示例3: getAllImage

 public function getAllImage()
 {
     $model = Person::model()->findAll();
     foreach ($model as $m) {
         $mas[] = $m['img'];
     }
     return array_unique($mas);
 }
开发者ID:N-Aon-Ma,项目名称:mk10,代码行数:8,代码来源:Person.php

示例4: newPasswordEmail

 protected function newPasswordEmail()
 {
     $owner = $this->getOwner();
     $template = SettingsEmailTemplate::model()->getRow('*', '`key`=:t1', array(':t1' => SettingsEmailTemplate::KEY_RESET_PASSWORD));
     if (empty($template)) {
         return FALSE;
     }
     $site_name = Yii::app()->settings->get(Constants::CATEGORY_GENERAL, Constants::KEY_SITE_NAME, Yii::app()->name);
     //placeholders: {name},{link},{username} {email},{password},
     $body = Common::myStringReplace($template['body'], array('{name}' => Person::model()->get($owner->id, 'CONCAT(`first_name`," ",`last_name`)'), '{link}' => Yii::app()->createAbsoluteUrl('auth/default/login'), '{username}' => $owner->username, '{email}' => $owner->email, '{password}' => $owner->genericField));
     MsgEmailOutbox::model()->push(array('from_name' => $site_name, 'from_email' => $template['from'], 'to_email' => $owner->email, 'subject' => $template['subject'], 'message' => $body));
 }
开发者ID:wanyos2005,项目名称:hsbf,代码行数:12,代码来源:UserBehavior.php

示例5: actionListPersonsWithSameFirstname

 /**
 * Displays list on persons that have same firstname as person with given id
 */
 public function actionListPersonsWithSameFirstname()
 {
     if (isset($_GET['id'])) {
         $model = Person::model()->findbyPk($_GET['id']);
     }
     if ($model !== null) {
         $models = Person::model()->findAll("firstname='{$model->firstname}'");
         $data = array();
         foreach ($models as $model) {
             $data[] = $model->fullname;
         }
         echo Yii::t('ui', 'Persons with same firstname: ') . implode(', ', $data);
     }
 }
开发者ID:josterricardo,项目名称:proyecto-cirugia,代码行数:17,代码来源:ProveedorController.php

示例6: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $id = Yii::app()->user->id;
     $user_model = Users::model()->loadModel($id);
     $person_model = Person::model()->loadModel($id);
     $address_model = PersonAddress::model()->find('`person_id`=:t1', array(':t1' => $id));
     if (NULL === $address_model) {
         $address_model = new PersonAddress();
         $address_model->person_id = $id;
     }
     $models = $this->modelsLoop();
     $models = $this->addNewModel($models, $this->modelSave($models));
     $this->render('application.modules.users.views.default.view', array('user_model' => $user_model, 'person_model' => $person_model, 'address_model' => $address_model, 'models' => $models, 'jamaa' => Person::model()->findByPk($_REQUEST['id']), 'child' => DependentMembers::model()->dependents($id, 5) || DependentMembers::model()->dependents($id, 10), 'spouse' => DependentMembers::model()->dependents($id, 4) || DependentMembers::model()->dependents($id, 9), 'prnts' => DependentMembers::model()->dependents($id, 1) || DependentMembers::model()->dependents($id, 6), 'inlaws' => DependentMembers::model()->dependents($id, 2) || DependentMembers::model()->dependents($id, 7), 'siblings' => DependentMembers::model()->dependents($id, 3) || DependentMembers::model()->dependents($id, 8), 'action' => Users::ACTION_ADD_DEPENDENTS, 'render' => 'application.modules.members.views.dependentMembers.create'));
 }
开发者ID:wanyos2005,项目名称:hsbf,代码行数:18,代码来源:DependentMembersController.php

示例7: sendEmail

 public function sendEmail()
 {
     $this->user_model->password_reset_code = Common::generateSalt();
     $this->user_model->password_reset_request_date = date('Y-m-d H:i:s');
     $this->user_model->save(false);
     $template = SettingsEmailTemplate::model()->getRow('*', '`key`=:t1', array(':t1' => SettingsEmailTemplate::KEY_FORGOT_PASSWORD));
     if (empty($template)) {
         return FALSE;
     }
     //placeholders : {name},{link}
     $body = Common::myStringReplace($template['body'], array('{name}' => Person::model()->get($this->user_model->id, 'CONCAT(first_name," ",last_name)'), '{link}' => Yii::app()->createAbsoluteUrl('auth/default/resetPassword', array('id' => $this->user_model->id, 'token' => $this->user_model->password_reset_code))));
     //$from, $this->user_model->email, $template->title, $template->body, true
     MsgEmailOutbox::model()->push(array('from_name' => Yii::app()->settings->get(Constants::CATEGORY_GENERAL, Constants::KEY_SITE_NAME, Yii::app()->name), 'from_email' => $template['from'], 'to_email' => $this->user_model->email, 'subject' => $template['subject'], 'message' => $body));
 }
开发者ID:wanyos2005,项目名称:hsbf,代码行数:14,代码来源:ForgotPasswordForm.php

示例8: getOrCreate

 /**
  * @param string $name
  * @param string $name_normalized
  * @return Person
  * @throws Exception
  */
 public static function getOrCreate($name, $name_normalized)
 {
     /** @var Person|null $pers */
     $pers = Person::model()->findByAttributes(["name_normalized" => $name_normalized]);
     if (is_null($pers)) {
         $pers = new Person();
         $pers->name = $name;
         $pers->name_normalized = $name_normalized;
         $pers->typ = static::$TYP_SONSTIGES;
         if (!$pers->save()) {
             RISTools::send_email(Yii::app()->params['adminEmail'], "Person:getOrCreate Error", print_r($pers->getErrors(), true), null, "system");
             throw new Exception("Fehler beim Speichern: Person");
         }
     }
     return $pers;
 }
开发者ID:CatoTH,项目名称:Muenchen-Transparent,代码行数:22,代码来源:Person.php

示例9: isAdminCurUser

 /**
  * @return bool
  */
 public function isAdminCurUser()
 {
     $user = Yii::app()->user;
     if ($user->isGuest) {
         return false;
     }
     if ($user->getState("role") === "admin") {
         return true;
     }
     $ich = Person::model()->findByAttributes(array("auth" => $user->id));
     /** @var Person $ich */
     if ($ich == null) {
         return false;
     }
     return $this->isAdmin($ich);
 }
开发者ID:andi98,项目名称:antragsgruen,代码行数:19,代码来源:Veranstaltungsreihe.php

示例10: actionView

 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $model = $this->loadModel($id);
     $itemsmodel = array();
     $person = Person::model()->findAll("idPreuniGroup = " . $model->SpecialityID);
     foreach ($person as $pitem) {
         $sp = Statementpersons::model()->find("PersonID = {$pitem->idPerson} and StatementID = {$model->idStatement}");
         if (empty($sp)) {
             $sp = new Statementpersons();
             $sp->PersonID = $pitem->idPerson;
             $sp->StatementID = $model->idStatement;
             $sp->isNewRecord = false;
         }
         $itemsmodel[] = $sp;
     }
     $this->render('view', array('model' => $this->loadModel($id), "itemsmodel" => $itemsmodel));
 }
开发者ID:upmunspel,项目名称:abiturient,代码行数:21,代码来源:StatementsController.php

示例11: actionView

 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id = NULL, $action = NULL)
 {
     if (NULL === $id) {
         $id = Yii::app()->user->id;
     }
     $user_model = Users::model()->loadModel($id);
     $person_model = Person::model()->loadModel($id);
     $this->resource = Users::USER_RESOURCE_PREFIX . $user_model->user_level;
     if (!Users::isMyAccount($id)) {
         $this->hasPrivilege();
     }
     $this->pageTitle = $person_model->name;
     $this->showPageTitle = TRUE;
     $address_model = PersonAddress::model()->find('`person_id`=:t1', array(':t1' => $id));
     if (NULL === $address_model) {
         $address_model = new PersonAddress();
         $address_model->person_id = $id;
     }
     if (!empty($action)) {
         if (!Users::isMyAccount($id)) {
             $this->checkPrivilege($user_model, Acl::ACTION_UPDATE);
         }
         switch ($action) {
             case Users::ACTION_UPDATE_PERSONAL:
                 $this->update($person_model);
                 break;
             case Users::ACTION_UPDATE_ACCOUNT:
                 $this->update($user_model);
                 break;
             case Users::ACTION_UPDATE_ADDRESS:
                 $this->update($address_model);
                 break;
             case Users::ACTION_RESET_PASSWORD:
                 $this->resetPassword($user_model);
                 break;
             case Users::ACTION_CHANGE_PASSWORD:
                 $this->changePassword($user_model);
                 break;
             default:
                 $action = NULL;
         }
     }
     $this->render('view', array('user_model' => $user_model, 'person_model' => $person_model, 'address_model' => $address_model, 'action' => $action));
 }
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:48,代码来源:DefaultController.php

示例12: istSichtbarCurrUser

 /**
  * @return bool
  */
 public function istSichtbarCurrUser()
 {
     if ($this->status == static::$STATUS_GELOESCHT) {
         return false;
     }
     if ($this->status == static::$STATUS_FREI) {
         return true;
     }
     if ($this->getVeranstaltung()->isAdminCurUser()) {
         return true;
     }
     $user = Yii::app()->user;
     if ($user->isGuest) {
         return false;
     }
     /** @var Person $ich  */
     $ich = Person::model()->findByAttributes(array("auth" => $user->id));
     return $ich->id == $this->verfasserIn_id;
 }
开发者ID:andi98,项目名称:antragsgruen,代码行数:22,代码来源:IKommentar.php

示例13: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $id = Yii::app()->user->id;
     $user_model = Users::model()->loadModel($id);
     $person_model = Person::model()->loadModel($id);
     $address_model = PersonAddress::model()->find('`person_id`=:t1', array(':t1' => $id));
     if (NULL === $address_model) {
         $address_model = new PersonAddress();
         $address_model->person_id = $id;
     }
     $models = self::kinsOrNominees();
     //$this->performAjaxValidation($model);
     if (isset($_POST['KinsAndNominees'])) {
         foreach ($models as $m => $model) {
             $models[$m]->attributes = $_POST['KinsAndNominees'][$model->dependent_member];
             KinsAndNominees::model()->modelSave($models[$m]);
         }
     }
     $this->render('application.modules.users.views.default.view', array('user_model' => $user_model, 'person_model' => $person_model, 'address_model' => $address_model, 'models' => $models, 'jamaa' => Person::model()->findByPk($_REQUEST['id']), 'child' => DependentMembers::model()->dependents($id, 5) || DependentMembers::model()->dependents($id, 10), 'spouse' => DependentMembers::model()->dependents($id, 4) || DependentMembers::model()->dependents($id, 9), 'prnts' => DependentMembers::model()->dependents($id, 1) || DependentMembers::model()->dependents($id, 6), 'inlaws' => DependentMembers::model()->dependents($id, 2) || DependentMembers::model()->dependents($id, 7), 'siblings' => DependentMembers::model()->dependents($id, 3) || DependentMembers::model()->dependents($id, 8), 'action' => $_REQUEST['kiNom'] == 'kin' ? KinsAndNominees::NEXT_OF_KIN : KinsAndNominees::NOMINEE, 'render' => 'application.views.kinsAndNominees.create'));
 }
开发者ID:wanyos2005,项目名称:hsbf,代码行数:24,代码来源:KinsAndNomineesController.php

示例14: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Tournament();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Tournament'])) {
         $model->attributes = $_POST['Tournament'];
         $person = Person::model()->findAll();
         foreach ($person as $p) {
             $t[] = $p['id'];
         }
         //arra
         if ($model->save()) {
             for ($i = 0; $i < $model->count; $i++) {
                 $battle = new Battle();
             }
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:N-Aon-Ma,项目名称:mk10,代码行数:25,代码来源:TournamentController.php

示例15: getSubmitPerson

 protected function getSubmitPerson($andereAntragstellerInErlaubt)
 {
     if (Yii::app()->user->isGuest) {
         $antragstellerIn = null;
     } elseif ($andereAntragstellerInErlaubt && isset($_REQUEST["andere_antragstellerIn"])) {
         $antragstellerIn = null;
     } else {
         /** @var Person $antragstellerIn */
         $antragstellerIn = Person::model()->findByAttributes(array("auth" => Yii::app()->user->id));
         if ($antragstellerIn) {
             $name_aenderung = isset($_REQUEST["Person"]["name"]) && $antragstellerIn->name !== $_REQUEST["Person"]["name"];
             $orga_aenderung = isset($_REQUEST["Person"]["organisation"]) && $antragstellerIn->organisation !== $_REQUEST["Person"]["organisation"];
             if ($name_aenderung || $orga_aenderung) {
                 $antragstellerIn->name = $_REQUEST["Person"]["name"];
                 if (isset($_REQUEST["Person"]["organisation"])) {
                     $antragstellerIn->organisation = $_REQUEST["Person"]["organisation"];
                 }
                 $antragstellerIn->save();
             }
         }
     }
     if (isset($_REQUEST["Person"])) {
         if ($antragstellerIn === null) {
             $antragstellerIn = new Person();
             $antragstellerIn->attributes = $_REQUEST["Person"];
             $antragstellerIn->telefon = isset($_REQUEST["Person"]["telefon"]) ? $_REQUEST["Person"]["telefon"] : "";
             $antragstellerIn->typ = isset($_REQUEST["Person"]["typ"]) && $_REQUEST["Person"]["typ"] == "organisation" ? Person::$TYP_ORGANISATION : Person::$TYP_PERSON;
             $antragstellerIn->angelegt_datum = new CDbExpression('NOW()');
             $antragstellerIn->status = Person::$STATUS_UNCONFIRMED;
             $antragstellerIn->save();
         } else {
             if (!$antragstellerIn->telefon && isset($_REQUEST["Person"]["telefon"]) && $_REQUEST["Person"]["telefon"] != "") {
                 $antragstellerIn->telefon = $_REQUEST["Person"]["telefon"];
                 $antragstellerIn->save();
             }
         }
     }
     return $antragstellerIn;
 }
开发者ID:andi98,项目名称:antragsgruen,代码行数:39,代码来源:IPolicyAntraege.php


注:本文中的Person::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。