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


PHP Subject::setCode方法代碼示例

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


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

示例1: 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

示例2: 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

示例3:

				<option value="3">3</option>
				<option value="4" selected>4</option>
			</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->setCode($_POST["code"]);
                                $subject->setName($_POST["name"]);
                                $subject->setDescription($_POST["description"]);
                                $subject->setStartYear($_POST["startYear"]);
                                $subject->setStopYear($_POST["stopYear"]);
                                if ($subject->validate()) {
                                    if ($subject->update()) {
                                        $pageBody .= '
<table>
<tbody>
	<tr>
		<th>code</th>
		<td>' . $subject->getCode() . '</td>
	</tr>
	<tr>
		<th>name</th>
開發者ID:eebrah,項目名稱:schoolsys,代碼行數:31,代碼來源:index.php


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