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


PHP Subject::save方法代码示例

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


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

示例1: actionAdd

 public function actionAdd()
 {
     global $arr_response;
     $model = new Subject();
     $model->scenario = 'add';
     $_REQUEST['content_type_id'] = ContentType::model()->find('name=:name', array(':name' => $_REQUEST['content_type']))->id;
     $_REQUEST['country_id'] = Country::model()->find('code=:code', array(':code' => $_REQUEST['country_code']))->id;
     $_REQUEST['priority_id'] = Priority::model()->find('name=:name', array(':name' => $_REQUEST['priority']))->id;
     if ($_REQUEST['time']) {
         if (date("l", $_REQUEST['time'])) {
             //if its a valid timestamp
             $_REQUEST['user_position_ymd'] = date("Y", $_REQUEST['time']) . "/" . date("m", $_REQUEST['time']) . "/" . date("d", $_REQUEST['time']);
             $_REQUEST['user_position_hour'] = date("H", $_REQUEST['time']);
             $_REQUEST['user_position_minute'] = date("i", $_REQUEST['time']);
         }
     } else {
         $_REQUEST['user_position_anydatetime'] = 1;
     }
     $model->attributes = $_REQUEST;
     //NOTICE that we are creating a new record, so model its not loaded, ($model->content_type its juest the received $_REQUEST parameter)
     //print_r($model);
     //$model->content_type_id = $content_type->id;
     if ($model->save()) {
         $arr_response['response_message'] = Yii::t('subject', 'Subject successfully saved.');
     } else {
         $arr_response['response_code'] = 409;
         $arr_response['response_message'] = Yii::t('subject', 'Subject could not be saved.');
         $arr_response['response_details'] = $model->getErrors();
     }
 }
开发者ID:jjsub,项目名称:samesub,代码行数:30,代码来源:SubjectController.php

示例2: store

 public function store()
 {
     $subject = new Subject();
     $subject->name = Input::get('name');
     $subject->save();
     Session::flash('message', 'Sukses menambahkan bidang studi baru!');
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:7,代码来源:SubjectsController.php

示例3: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $rules = ['name' => 'required', 'code' => 'required', 'type' => 'required', 'subgroup' => 'required', 'stdgroup' => 'required', 'class' => 'required', 'totalfull' => 'required', 'wfull' => 'required', 'mfull' => 'required', 'sfull' => 'required', 'pfull' => 'required'];
     $validator = \Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('/subject/create')->withErrors($validator);
     } else {
         $exsubject = Subject::select('*')->where('class', Input::get('class'))->where('code', Input::get('code'))->get();
         if (count($exsubject) > 0) {
             $errorMessages = new Illuminate\Support\MessageBag();
             $errorMessages->add('deplicate', 'subject all ready exists for this class!!');
             return Redirect::to('/subject/create')->withErrors($errorMessages);
         } else {
             $subject = new Subject();
             $subject->name = Input::get('name');
             $subject->code = Input::get('code');
             $subject->class = Input::get('class');
             $subject->type = Input::get('type');
             $subject->subgroup = Input::get('subgroup');
             $subject->stdgroup = Input::get('stdgroup');
             $subject->totalfull = Input::get('totalfull');
             $subject->totalpass = Input::get('totalpass');
             $subject->wfull = Input::get('wfull');
             $subject->wpass = Input::get('wpass');
             $subject->mfull = Input::get('mfull');
             $subject->mpass = Input::get('mpass');
             $subject->sfull = Input::get('sfull');
             $subject->spass = Input::get('spass');
             $subject->pfull = Input::get('pfull');
             $subject->ppass = Input::get('ppass');
             $subject->save();
             return Redirect::to('/subject/create')->with("success", "Subject Created Succesfully.");
         }
     }
 }
开发者ID:hrshadhin,项目名称:school-management-system,代码行数:40,代码来源:subjectController.php

示例4: actionCreate

 /**
  * 录入
  *
  */
 public function actionCreate()
 {
     parent::_acl('subject_create');
     $model = new Subject();
     $imageList = $this->_gets->getPost('imageList');
     $layoutList = $this->_gets->getPost('layoutList');
     $imageListSerialize = XUtils::imageListSerialize($imageList);
     $layoutListSerialize = XUtils::imageListSerialize($layoutList);
     if (isset($_POST['Subject'])) {
         $file = XUpload::upload($_FILES['attach']);
         $model->attributes = $_POST['Subject'];
         $model->date = strtotime($_POST['Subject']['date']);
         if (is_array($file)) {
             $model->room_type_image = $file['pathname'];
         }
         $model->image_list = $imageListSerialize['dataSerialize'];
         $model->layout_list = $layoutListSerialize['dataSerialize'];
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入项目,ID:' . $model->id));
             $this->redirect(array('index'));
         }
     }
     $this->city_list = parent::_groupList('city');
     $this->render('create', array('model' => $model, 'imageList' => $imageListSerialize['data'], 'layoutList' => $layoutListSerialize['data']));
 }
开发者ID:zywh,项目名称:maplecity,代码行数:29,代码来源:SubjectController.php

示例5: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Eloquent::unguard();
     DB::table('propel_fellow_wingman')->delete();
     DB::table('propel_student_wingman')->delete();
     Subject::truncate();
     DB::table('propel_city_subject')->delete();
     CalendarEvent::truncate();
     CancelledCalendarEvent::truncate();
     WingmanModule::truncate();
     WingmanTime::truncate();
     VolunteerTime::truncate();
     WingmanJournal::truncate();
     $fellow = Fellow::find(1);
     $wingman1 = Wingman::find(2);
     $wingman2 = Wingman::find(3);
     $fellow->wingman()->attach($wingman1);
     $fellow->wingman()->attach($wingman2);
     $student1 = Student::find(3);
     $student2 = Student::find(4);
     $wingman1->student()->attach($student1);
     $wingman1->student()->attach($student2);
     $cEvent1 = new CalendarEvent();
     $cEvent1->type = 'volunteer_time';
     $cEvent1->student()->associate($student1);
     $cEvent1->status = 'created';
     $cEvent1->save();
     $vTime1 = new VolunteerTime();
     $vTime1->calendarEvent()->associate($cEvent1);
     $volunteer1 = Volunteer::find(4);
     $vTime1->volunteer()->associate($volunteer1);
     $subject1 = new Subject();
     $subject1->name = "English";
     $subject1->save();
     $vTime1->subject()->associate($subject1);
     $vTime1->save();
     $cEvent2 = new CalendarEvent();
     $cEvent2->type = 'wingman_time';
     $cEvent2->student()->associate($student1);
     $cEvent2->status = 'created';
     $cEvent2->save();
     $wTime1 = new WingmanTime();
     $wTime1->calendarEvent()->associate($cEvent2);
     $wTime1->wingman()->associate($wingman1);
     $wModule1 = new WingmanModule();
     $wModule1->name = "Programming";
     $wModule1->save();
     $wTime1->wingmanModule()->associate($wModule1);
     $wTime1->save();
     $city1 = City::find(1);
     $subject1->city()->attach($city1);
     $wJournal1 = new WingmanJournal();
     $wJournal1->type = 'formal';
     $wJournal1->title = "Day at Navy Camp";
     $wJournal1->mom = "It was awesome";
     $wJournal1->student()->associate($student1);
     $wJournal1->wingman()->associate($wingman1);
     $wJournal1->save();
 }
开发者ID:makeadiff,项目名称:propel,代码行数:64,代码来源:DatabaseSeeder.php

示例6: create

 private function create()
 {
     $subject = new Subject();
     $subject->subjectname = Input::get('name');
     $subject->subjectcode = Input::get('code');
     $subject->grade = Input::get('grade');
     $subject->save();
 }
开发者ID:eufelipemartins,项目名称:edlara,代码行数:8,代码来源:SubjectController.php

示例7: actionCreate

 /**
  * Создает новую модель Предмета.
  * Если создание прошло успешно - перенаправляет на просмотр.
  *
  * @return void
  */
 public function actionCreate()
 {
     $model = new Subject();
     if (Yii::app()->getRequest()->getPost('Subject') !== null) {
         $model->setAttributes(Yii::app()->getRequest()->getPost('Subject'));
         if ($model->save()) {
             Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('SubjectModule.subject', 'Запись добавлена!'));
             $this->redirect((array) Yii::app()->getRequest()->getPost('submit-type', ['update', 'id' => $model->id]));
         }
     }
     $this->render('create', ['model' => $model]);
 }
开发者ID:shipovalovyuriy,项目名称:spasibeaucoup,代码行数:18,代码来源:SubjectBackendController.php

示例8: save

 public function save()
 {
     $subjectId = $this->getValue('subjectId');
     if (!empty($subjectId)) {
         $subject = $this->getSubjectService()->getSubjectById($subjectId);
     } else {
         $subject = new Subject();
     }
     $subject->setCode($this->getValue('code'));
     $subject->setName($this->getValue('name'));
     $subject->save();
 }
开发者ID:andgatetech,项目名称:hrm,代码行数:12,代码来源:SubjectForm.php

示例9: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Subject();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Subject'])) {
         $model->attributes = $_POST['Subject'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:DostonAkhmedov,项目名称:Dars_jadvali,代码行数:17,代码来源:SubjectController.php

示例10: actionCreate

 /**
  * Создает новую модель Предмета.
  * Если создание прошло успешно - перенаправляет на просмотр.
  *
  * @return void
  */
 public function actionCreate()
 {
     $roles = ['1', '5', '4'];
     $role = \Yii::app()->user->role;
     if (array_intersect($role, $roles)) {
         $model = new Subject();
         if (Yii::app()->getRequest()->getPost('Subject') !== null) {
             $model->setAttributes(Yii::app()->getRequest()->getPost('Subject'));
             if ($model->save()) {
                 Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('SubjectModule.subject', 'Запись добавлена!'));
                 $this->redirect((array) Yii::app()->getRequest()->getPost('submit-type', ['update', 'id' => $model->id]));
             }
         }
         $this->render('create', ['model' => $model]);
     } else {
         throw new CHttpException(403, 'Ошибка прав доступа.');
     }
 }
开发者ID:shipovalovyuriy,项目名称:spasibeaucoup,代码行数:24,代码来源:SubjectController.php

示例11: addSubject

 /**
  * Store a subject in the Subject collection
  * 
  * @return View
  */
 public function addSubject()
 {
     $subject = new Subject();
     $subject->name = strtoupper(trim(Input::get('subject_name')));
     $subject->university_id = Auth::id();
     $subject->school = strtoupper(trim(Input::get('school')));
     $sections = explode(',', Input::get('section'));
     foreach ($sections as $section) {
         $sect = new Section();
         $sect->code = strtoupper(trim($section));
         $sect->is_free = true;
         $subject->sections()->associate($sect);
     }
     try {
         $subject->save();
     } catch (MongoDuplicateKeyException $e) {
         return Redirect::back()->withErrors(array('error' => Lang::get('add_subject.subject_duplicated')));
     }
     return Redirect::to(Lang::get('routes.add_subject'))->with('message', Lang::get('add_subject.success'));
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:25,代码来源:SubjectController.php

示例12: executeUpdate

 public function executeUpdate()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $subject = new Subject();
         $subject->setCode($this->getRequestParameter('code'));
         $subject->setName($this->getRequestParameter('name'));
         $subject->setCredit($this->getRequestParameter('credit'));
         $subject->setSubjectGroupId($this->getRequestParameter('subject_group_id'));
         $subject->setDepartmentId($this->getRequestParameter('department_id'));
         $subject->save();
         #$subject_curr = new SubjectCurr();
         #$subject_curr->setSubject($subject);
         #$subject_curr->setCurriculumId($this->getRequestParameter('curriculum_id'));
         #$subject_curr->save();
         #$c = new Criteria();
         #$c->add(AcademicCalendarPeer::CURRICULUM_ID, $this->getRequestParameter('curriculum_id'));
         #$currs = AcademicCalendarPeer::doSelect($c);
         #foreach ($currs as $curr) {
         #	$subject_accal = new SubjectAccal();
         #	$subject_accal->setSubject($subject);
         #	$subject_accal->setAcademicCalendarId($curr->getId());
         #	$subject_accal->setEmployeeId($this->getRequestParameter('employee_id'));
         #	$subject_accal->save();
         #	$subject_accal_lector = new SubjectAccalLector();
         #	$subject_accal_lector->setSubjectAccal($subject_accal);
         #	$subject_accal_lector->setEmployeeId($this->getRequestParameter('employee_id'));
         #	$subject_accal_lector->save();
         #}
         $subject_accal = new SubjectAccal();
         $subject_accal->setSubject($subject);
         $subject_accal->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
         $subject_accal->setEmployeeId($this->getRequestParameter('employee_id'));
         $subject_accal->save();
         #$subject_accal_lector = new SubjectAccalLector();
         #$subject_accal_lector->setSubjectAccal($subject_accal);
         #$subject_accal_lector->setEmployeeId($this->getRequestParameter('employee_id'));
         #$subject_accal_lector->save();
     } else {
         $subject = SubjectPeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($subject);
         $subject->setId($this->getRequestParameter('id'));
         $subject->setCode($this->getRequestParameter('code'));
         $subject->setName($this->getRequestParameter('name'));
         $subject->setCredit($this->getRequestParameter('credit'));
         $subject->setSubjectGroupId($this->getRequestParameter('subject_group_id'));
         $subject->setDepartmentId($this->getRequestParameter('department_id'));
         $subject->save();
         $c = new Criteria();
         $c->add(SubjectAccalPeer::ID, $this->getRequestParameter('subject_accal_id'));
         $subject_accal = SubjectAccalPeer::doSelectOne($c);
         #$subject_accal = SubjectAccalPeer::retrieveByPk($this->getRequestParameter('subject_accal_id'));
         #$this->forward404Unless($subject_accal);
         $subject_accal->setId('subject_accal_id');
         $subject_accal->setSubject($subject);
         $subject_accal->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
         $subject_accal->setEmployeeId($this->getRequestParameter('employee_id'));
         $subject_accal->save();
     }
     return $this->redirect('subject/list');
 }
开发者ID:taryono,项目名称:school,代码行数:65,代码来源:actions.class.php

示例13: Subject

			</select>
		</div>
	</fieldset>
	<fieldset class="buttons">
		<button type="reset">reset</button>
		<button type="submit"
				name="stage"
				value="2">submit</button>
	</fieldset>
</form>
</div>';
                            break;
                        case "2":
                            $subject = new Subject("00000", $_POST["code"], $_POST["name"], $_POST["description"], $_POST["startYear"], $_POST["stopYear"]);
                            if ($subject->validate()) {
                                if ($subject->save()) {
                                    $pageBody .= '
<table>
<tbody>
	<tr>
		<th>code</th>
		<td>' . $subject->getCode() . '</td>
	</tr>
	<tr>
		<th>name</th>
		<td>' . $subject->getName() . '</td>
	</tr>
	<tr>
		<th>description</th>
		<td>' . $subject->getDescription() . '</td>
	</tr>
开发者ID:eebrah,项目名称:schoolsys,代码行数:31,代码来源:index.php

示例14: actionAjaxCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionAjaxCreate()
 {
     $model = new Subject();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Subject'])) {
         $model->attributes = $_POST['Subject'];
         if ($model->save()) {
             $this->redirect(array('index', 'id' => $model->ID));
         }
     }
     $this->renderPartial('_form', array('model' => $model), false, true);
 }
开发者ID:vuvankhai,项目名称:itplus,代码行数:17,代码来源:SubjectController.php

示例15: navigation

<?php

require_once '../../includes/initialize.php';
?>
	
<?php 
selected_page();
if (isset($_POST['submit'])) {
    $new_subject = new Subject();
    $new_subject->menu_name = trim($_POST['menu_name']);
    $new_subject->visible = (int) trim($_POST['visible']);
    $new_subject->position = (int) trim($_POST['position']);
    if ($new_subject->save()) {
        $message = "New Subject Added";
    } else {
        $message = "Failed to Add New Subject";
    }
}
include_layout_template("admin_header");
?>

	<nav>
		<br>
		<a href="index.php">&laquo; Back</a>
		<br>
		<?php 
echo navigation($current_subject, $current_page);
?>
	</nav>
		
		<div class="page">
开发者ID:Radomeer,项目名称:kec_cms,代码行数:31,代码来源:new_subject.php


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