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


PHP Person::findOne方法代码示例

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


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

示例1: actionView

 public function actionView()
 {
     $id = \Yii::$app->getRequest()->get()['match'];
     $vacancy = \Yii::$app->getRequest()->get()['vacancy'];
     $person = Person::findOne($id);
     return $this->render("view", ["person" => $person]);
 }
开发者ID:janwillemm,项目名称:sa-matcher,代码行数:7,代码来源:MatchController.php

示例2: findModel

 /**
  * Finds the model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Person::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('Страница не найдена');
     }
 }
开发者ID:serge-larin,项目名称:debt-test,代码行数:15,代码来源:DefaultController.php

示例3: actionDelete

 public function actionDelete($id)
 {
     $person = Person::findOne($id);
     if ($person == null) {
         throw new \yii\web\NotFoundHttpException('This record does not exists.');
     }
     $person->delete();
     \Yii::$app->session->addFlash('success', 'Record deleted successfully.');
     header("Location: /persons/web");
     exit;
 }
开发者ID:jrss95,项目名称:persons,代码行数:11,代码来源:SiteController.php

示例4: actionResponse

 public function actionResponse()
 {
     $session = new Session();
     $session->open();
     $tud = $session['tud'];
     // First try to find id
     $person = Person::findOne(['tud_id' => $tud['uid']]);
     if ($person) {
         $person->updatePerson($tud);
         return $this->login($person);
     }
     // Then try to find emailaddress (Which is also a valid identifier)
     $person = Person::findOne(['emailaddress' => $tud['email']]);
     if ($person) {
         $person->updatePerson($tud);
         return $this->login($person);
     }
     return $this->create($tud);
 }
开发者ID:janwillemm,项目名称:sa-matcher,代码行数:19,代码来源:AuthenticationController.php

示例5: function

use yii\grid\GridView;
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $searchModel app\models\ProjectManagerSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Eliminar responsables de proyecto';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="project-manager-index">

    <div class="well well-sm">
        <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    </div>


    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', ['attribute' => 'Nombre', 'value' => function ($dataProvider) {
    $user = \app\models\User::findOne(['id' => $dataProvider->user_id]);
    $person = \app\models\Person::findOne(['id' => $user->person_id]);
    return $person->name . ' ' . $person->lastname;
}], 'organization', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{delete}', 'buttons' => ['delete' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', ['delete', 'user_id' => $model['user_id']], ['title' => Yii::t('app', 'Delete'), 'data-confirm' => Yii::t('app', '¿Estas seguro que deseas eliminar?'), 'data-method' => 'post']);
}]]]]);
?>

</div>
开发者ID:RomarioLopezC,项目名称:RobotSS,代码行数:29,代码来源:index.php

示例6:

    </div>
    <div class="col-xs-4">
        <?php 
echo $projectM->organization;
?>
<br>
        <?php 
echo $project->dependency;
?>
<br>
        <?php 
echo Person::findOne(\app\models\User::findOne($projectM->user_id)->person_id)->name . ' ' . Person::findOne(\app\models\User::findOne($projectM->user_id)->person_id)->lastname;
?>
        <br>
        <?php 
echo Person::findOne(\app\models\User::findOne($projectM->user_id)->person_id)->name . ' ' . Person::findOne(\app\models\User::findOne($projectM->user_id)->person_id)->lastname;
?>
        <br>
    </div>
</div>

<div class="row" style="margin: 9em 0 0 0">
    <div class="col-xs-5">
        <p class="text-center">Firma y Sello</p>
        <p class="text-center" style="margin: 1.4em 0">_________________________</p>
    </div>
    <div class="col-xs-5">
        <p class="text-center">Firma</p>
        <p class="text-center" style="margin: 1.4em 0">_________________________</p>
    </div>
</div>
开发者ID:RomarioLopezC,项目名称:RobotSS,代码行数:31,代码来源:projectAssignmentPDF.php

示例7: actionIndex

 /**
  * Show homepage choices
  * @return mixed
  */
 public function actionIndex()
 {
     // TODO: Real current user
     $user = \app\models\Person::findOne(1);
     return $this->render('index', ['user' => $user]);
 }
开发者ID:janwillemm,项目名称:sa-matcher,代码行数:10,代码来源:StudentController.php

示例8: findModel

 /**
  * Finds the Person model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $firstname
  * @param string $lastname
  * @param string $dob
  * @return Person the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($firstname, $lastname, $dob)
 {
     if (($model = Person::findOne(['firstname' => $firstname, 'lastname' => $lastname, 'dob' => $dob])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
开发者ID:adamwiw,项目名称:yii-crud,代码行数:17,代码来源:PersonController.php

示例9: actionResetPassword

 public function actionResetPassword()
 {
     $this->layout = 'frontend';
     // Redirect if not match
     if (!isset($_GET['auth_key'])) {
         return $this->redirect(Yii::$app->params['siteUrl']);
     }
     $auth_key = $_GET['auth_key'];
     $model = \app\models\Person::findOne(['auth_key' => $auth_key]);
     // Redirect if not match
     if (!$model) {
         return $this->redirect(Yii::$app->params['siteUrl']);
     }
     // Set scenario
     $model->scenario = 'passwordReset';
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->session->setFlash('passwordResetComplete');
         return $this->redirect(['/login']);
     }
     return $this->render('reset-password', ['model' => $model]);
 }
开发者ID:jcshep,项目名称:FrontRunner,代码行数:21,代码来源:SiteController.php

示例10: function

use yii\grid\GridView;
use app\models\Person;
use yii\helpers\Url;
$this->title = "Matches";
$this->params['breadcrumbs'][] = ['label' => 'Employee', 'url' => ['employee/index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<h1>
    <?php 
echo $this->title;
?>
</h1>
<div class="vacancy-overview">
    <?php 
echo GridView::widget(array('dataProvider' => $provider, 'columns' => [['attribute' => 'Match Score', 'value' => 'score'], ['attribute' => 'Name', 'value' => 'name'], ['attribute' => 'Email', 'value' => 'emailaddress'], ['attribute' => 'Review AVG', 'content' => function ($model, $key, $index, $column) {
    $person = Person::findOne($model['id']);
    return $person->getReviewScore();
}]], 'rowOptions' => function ($model, $key, $index, $grid) {
    return ['data-id' => $model['id']];
}));
?>

</div>

    <style>
        .grid-view tbody tr:hover {
            cursor:pointer;
            text-decoration: underline;
        }

开发者ID:janwillemm,项目名称:sa-matcher,代码行数:29,代码来源:matches.php

示例11: actionPrint

 public function actionPrint()
 {
     $person = null;
     $billPersonal = null;
     if (isset($_GET['p'], $_GET['s'])) {
         $ids = explode(',', $_GET['s']);
         $person = Person::findOne($_GET['p']);
         $billPersonal = BillPersonal::getAsociated($_GET['p'], $ids);
         if ($person !== null && count($billPersonal) > 0) {
             $content = $this->renderPartial('print', ['person' => $person, 'billPersonal' => $billPersonal]);
             $pdf = new Pdf(['mode' => Pdf::MODE_UTF8, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => Yii::t('app', 'Bill') . ' ' . Yii::t('app', 'Report')], 'methods' => ['SetHeader' => [Yii::t('app', 'Summary')], 'SetFooter' => ['{PAGENO}']]]);
             return $pdf->render();
         }
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
开发者ID:edarkzero,项目名称:mi_taller,代码行数:17,代码来源:PersonController.php

示例12: actionPrintEvidenceReport

 /**
  * @return mixed|\yii\web\Response
  */
 public function actionPrintEvidenceReport()
 {
     $student = Student::findOne(['user_id' => Yii::$app->user->id]);
     date_default_timezone_set("America/Mexico_City");
     try {
         $searchModel = new StudentEvidenceSearch();
         $dataProviderAccepted = $searchModel->search(Yii::$app->request->queryParams, StudentEvidence::$ACCEPTED);
         $registration = Registration::findOne(['student_id' => $student->id]);
         $person = Person::findOne(User::findOne(Yii::$app->user->id)->person_id);
         $project = Project::findOne($registration->project_id);
         $projectM = ProjectManager::findOne($project->manager_id);
         // get your HTML raw content without any layouts or scripts
         $content = $this->render('studentEvidencePDF', ['registration' => $registration, 'student' => $student, 'person' => $person, 'project' => $project, 'projectM' => $projectM, 'searchModel' => $searchModel, 'dataProviderAccepted' => $dataProviderAccepted]);
         $formatter = \Yii::$app->formatter;
         // setup kartik\mpdf\Pdf component
         $pdf = new Pdf(['mode' => Pdf::MODE_UTF8, 'format' => Pdf::FORMAT_LETTER, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Reporte de avances'], 'methods' => ['SetFooter' => ['Fecha de expedición: ' . $formatter->asDate(date('d-F-Y'))]]]);
         // return the pdf output as per the destination setting
         return $pdf->render();
     } catch (InvalidConfigException $e) {
         Yii::$app->getSession()->setFlash('danger', 'No tienes proyectos asignados');
         return $this->redirect(Url::home());
     }
 }
开发者ID:RomarioLopezC,项目名称:RobotSS,代码行数:26,代码来源:StudentEvidenceController.php

示例13: actionDelete

 public function actionDelete($id)
 {
     Person::findOne($id)->delete();
     return $this->redirect(['/dashboard']);
 }
开发者ID:jcshep,项目名称:FrontRunner,代码行数:5,代码来源:PersonController.php

示例14: actionList

 public function actionList($id, $list)
 {
     $model = $this->findModel($id);
     // Get segment parameter and apply
     $segment = Yii::$app->request->get('segment');
     // Get role parameter and apply
     $role = Yii::$app->request->get('role');
     // Get related model (people)
     $query = $model->getPeople($list, $segment, $role);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 250]]);
     // Get list text from list id's
     if ($list == 1) {
         $list_type = 'Availability';
     }
     if ($list == 2) {
         $list_type = 'Final';
     }
     //Check if list action was submitted
     if ($selection = Yii::$app->request->post('selection')) {
         // Figure out what needs to be done
         $action = Yii::$app->request->post('action');
         switch ($action) {
             // Move to final list
             case 'list-move':
                 foreach ($selection as $person) {
                     $query = new Query();
                     $query->createCommand()->update('person_project', ['list' => 2], ['user_id' => $person, 'project_id' => $id, 'list' => $list])->execute();
                 }
                 return $this->redirect(['/project/list', 'id' => $id, 'list' => $list]);
                 break;
                 // Send Message
             // Send Message
             case 'send-message':
                 // Check if a file was uploaded
                 // Loop through checked users
                 foreach ($selection as $person) {
                     $person_model = Person::findOne($person);
                     $message = new \app\models\Message();
                     $message->user_id = $person_model->id;
                     $message->project_id = $id;
                     $message->message = Yii::$app->request->post('message');
                     $message->attachment = \yii\web\UploadedFile::getInstanceByName('attachment');
                     $message->time = time();
                     $message->status = 1;
                     $message->type = 'email';
                     //Set email to proper address / check if a family member and send there instead
                     $email = $person_model->email;
                     if (!$email && $person_model->family_id) {
                         $family_leader = Person::findOne($person_model->family_id);
                         $email = $family_leader->email;
                     }
                     if ($message->save() && $email && filter_var($email, FILTER_VALIDATE_EMAIL)) {
                         // Create mail item
                         $mail = Yii::$app->mailer->compose('/mail/message', ['message' => $message, 'person' => $person_model])->setTo($email)->setSubject('New Message From FrontRunner Casting');
                         // Set from address
                         if ($model->reply_to) {
                             $mail->setFrom($model->reply_to);
                         } else {
                             $mail->setFrom('info@frontrunnercasting.com');
                         }
                         // Add mail item to array
                         $messages[] = $mail;
                     }
                 }
                 //endforeach
                 // Try to send messages
                 if (isset($messages)) {
                     try {
                         Yii::$app->mailer->sendMultiple($messages);
                         Yii::$app->session->setFlash('messagesSent');
                     } catch (\Swift_SwiftException $exception) {
                         Yii::$app->session->setFlash('error', 'Messages could not be sent. Please try again.');
                     }
                 }
                 // Redirect back to list
                 return $this->redirect(['/project/list', 'id' => $id, 'list' => $list]);
                 break;
                 // Basic text message
             // Basic text message
             case 'send-text-message':
                 Yii::$app->session->setFlash('messagesSent');
                 $message = Yii::$app->request->post('text-message');
                 // Send Message with twilio
                 $model->sendText($selection, $message);
                 // Redirect back to list
                 return $this->redirect(['/project/list', 'id' => $id, 'list' => $list]);
                 break;
                 // Send availability check email
             // Send availability check email
             case 'availability-check':
                 foreach ($selection as $person) {
                     // Change status to requested
                     $query = new Query();
                     $query->createCommand()->update('person_project', ['availability' => 2], ['user_id' => $person, 'project_id' => $id, 'list' => $list])->execute();
                     // Get person model
                     $person_model = Person::findOne($person);
                     // Send Availability Check email
                     $message = new \app\models\Message();
                     $message->user_id = $person_model->id;
                     $message->project_id = $id;
//.........这里部分代码省略.........
开发者ID:jcshep,项目名称:FrontRunner,代码行数:101,代码来源:ProjectController.php

示例15: setPersonName

 /**
  * @param ActiveDataProvider $dataProvider
  * @return ActiveDataProvider
  */
 private function setPersonName($dataProvider)
 {
     $copy = clone $dataProvider;
     for ($i = 0; $i < sizeof($dataProvider->getModels()); $i++) {
         $userId = $dataProvider->getModels()[$i]['student']['user_id'];
         $user = User::findOne($userId);
         $person = Person::findOne($user['person_id']);
         $copy->getModels()[$i]['student']['user_id'] = $person['name'];
     }
     return $copy;
 }
开发者ID:RomarioLopezC,项目名称:RobotSS,代码行数:15,代码来源:StudentEvidenceController.php


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