當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Project::load方法代碼示例

本文整理匯總了PHP中app\models\Project::load方法的典型用法代碼示例。如果您正苦於以下問題:PHP Project::load方法的具體用法?PHP Project::load怎麽用?PHP Project::load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\models\Project的用法示例。


在下文中一共展示了Project::load方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionCreate

 /**
  * Creates a new Project model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Project();
     if ($model->load(Yii::$app->request->post())) {
         $model->status = R::PROJECT_CREATED;
         $model->deadline = date('Y-m-d', strtotime($model->deadline));
         $model->create_time = time();
         $model->update_time = time();
         $model->save();
         if (isset($_POST['stage_name'])) {
             $stage_name = $_POST['stage_name'];
             $stage_description = $_POST['stage_description'];
             $stage_deadline = $_POST['stage_deadline'];
             $stage_who = $_POST['stage_who'];
             foreach ($stage_name as $k => $v) {
                 $stage = new Stage();
                 $stage->name = $v;
                 $stage->description = $stage_description[$k];
                 $stage->deadline = strtotime($stage_deadline[$k]);
                 $stage->user_id = $stage_who[$k];
                 $stage->project_id = $model->id;
                 $stage->status = R::STAGE_CREATED;
                 $stage->create_time = time();
                 $stage->update_time = time();
                 $stage->save();
             }
         }
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
開發者ID:Sheriyev,項目名稱:G5-CRM,代碼行數:37,代碼來源:LeaderController.php

示例2: actionCreate

 /**
  * Creates a new Project model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Project();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
開發者ID:savers,項目名稱:trip1,代碼行數:14,代碼來源:ProjectController.php

示例3: actionCreate

 public function actionCreate()
 {
     $project = new Project();
     if ($project->load(Yii::$app->request->post()) && $project->save()) {
         Yii::$app->getSession()->setFlash("success", 'The record was saved.');
         return $this->redirect(["project/"]);
     }
     return $this->render("create", ["models" => ["project" => $project]]);
 }
開發者ID:JamesBarnsley,項目名稱:Neptune,代碼行數:9,代碼來源:ProjectController.php

示例4: actionCreate

 public function actionCreate()
 {
     if (\Yii::$app->user->isGuest) {
         throw new ForbiddenHttpException('Access denied');
     }
     $model = new Project();
     if ($model->load(\Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['/project/view', 'id' => $model->getPrimaryKey()]);
     }
     return $this->render('create', ['model' => $model]);
 }
開發者ID:mops1k,項目名稱:yiimine,代碼行數:11,代碼來源:ProjectController.php

示例5: actionCreate

 /**
  * Creates a new Project model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Project();
     $user_id = User::find()->where("id=" . Yii::$app->user->id)->one()->id;
     $manager_id = ProjectManager::find()->where("user_id=" . $user_id)->one()->id;
     $model->manager_id = $manager_id;
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         $vacancyValue = $_POST['Project']['vacancy'];
         $newVacancy = new ProjectVacancy();
         $newVacancy->project_id = $model->id;
         $newVacancy->vacancy = $vacancyValue;
         $newVacancy->save();
         $degreesList = $_POST['Project']['degrees1'];
         foreach ($degreesList as $value) {
             $this->createStudentProfile($model->id, $value);
         }
         Yii::$app->getSession()->setFlash('success', 'El proyecto se ha creado exitosamente');
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
開發者ID:RomarioLopezC,項目名稱:RobotSS,代碼行數:27,代碼來源:ProjectController.php

示例6: actionCopy

 /**
  * 複製項目配置
  *
  * @return string
  * @throws \Exception
  */
 public function actionCopy($projectId)
 {
     $project = $this->findModel($projectId);
     // 複製為新項目
     $project->name .= ' - copy';
     $copy = new Project();
     $copy->load($project->getAttributes(), '');
     if (!$copy->save()) {
         throw new \Exception(yii::t('conf', 'copy failed'));
     }
     // 刪除ansible配置文件
     if ($project->ansible) {
         copy(Project::getAnsibleHostsFile($project->id), Project::getAnsibleHostsFile($copy->id));
     }
     $this->renderJson([]);
 }
開發者ID:charlestang,項目名稱:walle-web,代碼行數:22,代碼來源:ConfController.php

示例7: actionCopy

 /**
  * 複製項目配置
  *
  * @return string
  * @throws \Exception
  */
 public function actionCopy($projectId)
 {
     $project = $this->findModel($projectId);
     // 複製為新項目
     $project->name .= ' - copy';
     $copy = new Project();
     $copy->load($project->getAttributes(), '');
     if (!$copy->save()) {
         throw new \Exception(yii::t('conf', 'copy failed'));
     }
     $this->renderJson([]);
 }
開發者ID:fnet123,項目名稱:walle-web,代碼行數:18,代碼來源:ConfController.php

示例8: actionCreate

 /**
  * Creates a new Project model.
  * If creation is successful, the browser will be redirected to the 'overview' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Project();
     $model->loadDefaultValues();
     if ($model->load(Yii::$app->request->post())) {
         $image = UploadedFile::getInstance($model, 'image');
         if (!is_null($image)) {
             // store the source file name
             $model->logoname = $image->name;
             $ext = end(explode(".", $image->name));
             // generate a unique file name
             $model->logo = Yii::$app->security->generateRandomString() . ".{$ext}";
             $path = Yii::$app->basePath . '/web/uploads/' . $model->logo;
         }
         if ($model->save()) {
             if (!is_null($image)) {
                 $image->saveAs($path);
             }
             $member = new Member();
             $member->setAttribute('project_id', $model->id);
             $member->setAttribute('user_id', Yii::$app->user->id);
             $member->setAttribute('role', 'Administrator');
             $member->save();
             return $this->redirect(['overview', 'identifier' => $model->identifier]);
         } else {
             Yii::$app->getSession()->setFlash('danger', Yii::t('app', 'Something went wrong and the settings was not saved.'));
         }
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
開發者ID:jacmoe,項目名稱:bugitor,代碼行數:36,代碼來源:ProjectController.php

示例9: actionCreate

 /**
  * Creates a new Project model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Project();
     $model->scenario = 'create';
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         // Add Twilio Number
         $model->addTwilioNumber();
         Yii::$app->session->setFlash('success', 'Project successfully created');
         return $this->redirect(['update', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
開發者ID:jcshep,項目名稱:FrontRunner,代碼行數:18,代碼來源:ProjectController.php


注:本文中的app\models\Project::load方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。