当前位置: 首页>>代码示例>>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;未经允许,请勿转载。