本文整理汇总了PHP中Teacher类的典型用法代码示例。如果您正苦于以下问题:PHP Teacher类的具体用法?PHP Teacher怎么用?PHP Teacher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Teacher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: photo_POST
function photo_POST($id)
{
$teacher = new Teacher($id);
$src = make_image('photo');
$teacher->update('photo', $src);
redirect("teacher/{$id}");
}
示例2: getAsObject
protected function getAsObject($row)
{
$result = new Teacher();
$result->setNew(false);
$result->setTeacherId(Singleton::create("NullConverter")->fromDBtoDOM($row["teacherId"]));
$result->setName(Singleton::create("NullConverter")->fromDBtoDOM($row["name"]));
return $result;
}
示例3: edit_teacher_POST
function edit_teacher_POST($id)
{
$description = _post('description');
$teacher = new Teacher($id);
if ($description) {
$teacher->update('description', $description);
}
redirect("teacher/{$id}/edit");
}
示例4: testTeacher
public function testTeacher()
{
$teacher = new Teacher("Teacher");
$groupLeader = new GroupLeader("GroupLeader");
$number = 10;
for ($i = 1; $i <= $number; $i++) {
$groupLeader->addGirl(new Girl("girl:{$i}"));
}
$teacher->commond($groupLeader);
}
示例5: testForTeacher
function testForTeacher()
{
$x = new Teacher(2);
$y = $x->consultation_requests();
$this->assertType('array', $y);
$this->assertEquals(3, count($y));
$z = array_shift($y);
$this->assertType('ConsultationRequest', $z);
$this->assertEquals(3, $z->id);
}
示例6: teacher_GET
/**
* @author ryan <cumt.xiaochi@gmail.com>
*/
function teacher_GET($id)
{
$teacher = new Teacher($id);
$comments = Comment::search()->filterBy('teacher', $id)->find();
$has_login = $GLOBALS['has_login'];
if ($has_login) {
$teacher->commentedByMe = $teacher->commentedByUser($GLOBALS['user']);
}
$schools = $GLOBALS['config']['school'];
render_view('master', compact('teacher', 'courses', 'comments', 'has_login', 'schools'));
}
示例7: selected_teachers
public function selected_teachers()
{
if (!is_null($this->id)) {
$teachers = new Teacher();
$teachers->where_related($this);
$teachers->get_iterated();
$output = array();
foreach ($teachers as $teacher) {
$output[$teacher->id] = $teacher->id;
}
return $output;
}
return array();
}
示例8: actionCreate
/**
* 录入
*
*/
public function actionCreate()
{
parent::_acl();
$model = new Teacher();
if (isset($_POST['Teacher'])) {
$acl = $this->_gets->getPost('acl');
$model->attributes = $_POST['Teacher'];
if ($model->save()) {
AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入内容,ID:' . $model->id));
$this->redirect(array('index'));
}
}
$this->render('teacher_create', array('model' => $model));
}
示例9: createTeacher
public function createTeacher(PropelPDO $con = null)
{
$con = is_null($con) ? Propel::getConnection() : $con;
$teacher = new Teacher();
$teacher->setPerson($this->getPerson());
$teacher->save($con);
$guard_user = $this->getPersonSfGuardUser();
if (!is_null($guard_user)) {
$teacher_group = BaseCustomOptionsHolder::getInstance('GuardGroups')->getStringFor(GuardGroups::TEACHER);
if (!array_key_exists($teacher_group, $guard_user->getGroups())) {
$guard_user->addGroupByName($teacher_group);
$guard_user->save($con);
}
}
}
示例10: testDocumentAdd
function testDocumentAdd()
{
$d = new Document(false);
$set = array('teacher_id' => 1, 'mediatype' => 'wma', 'url' => 'newsong.wma', 'description' => 'new song', 'pricecode' => 'b');
$new_id = $d->add($set);
$d = new Document($new_id);
$d->add_teacher($set['teacher_id']);
$this->assertEquals($set['description'], $d->description());
$t = new Teacher($set['teacher_id']);
$ds = $t->documents();
$this->assertType('array', $ds);
$this->assertArrayHasKey($new_id, $ds);
$d = $ds[$new_id];
$this->assertEquals($set['description'], $d->description());
}
示例11: addSectionCode
public function addSectionCode()
{
$section_code = new SectionCode();
$teacher = Teacher::find(Auth::Id());
$subject_id = Input::get('subject');
$section_id = Input::get('section');
$current_period = Input::get('current_period');
$section_code->teacher_id = new MongoId($teacher->_id);
$section_code->subject_id = new MongoId($subject_id);
$section_code->section_id = new MongoId($section_id);
$section_code->current_period = $current_period;
$section_code->teamleaders_id = array();
$section_code->students_id = array();
$section_code->status = true;
$subject = Subject::find($subject_id);
$section = $subject->sections()->find($section_id);
$code = $this->getInitialLetters($subject->name) . '-' . $section->code . '-' . $current_period;
$section_code->code = $code;
if (!is_null($section->current_code)) {
$sectionCode = SectionCode::where('code', $section->current_code)->first();
if (isset($sectionCode->_id)) {
$sectionCode->status = false;
$sectionCode->save();
}
}
try {
$section_code->save();
$section->current_code = $code;
$section->save();
} catch (MongoDuplicateKeyException $e) {
return Redirect::back()->withErrors(array('error' => Lang::get('section_codes.duplicate_code')));
}
return Redirect::to(Lang::get('routes.section_codes'))->with(array('message' => Lang::get('section_codes.success_message')));
}
示例12: __construct
/**
* This is construct base of the class.
*
* A public constructor; initializes the variable $instanceDataBase.
*
*/
public function __construct($instanceDataBase)
{
parent::__construct($instanceDataBase);
Teacher::setDataOperationBusiness($instanceDataBase);
Teacher::getBusiness();
Teacher::getDescriptionBusiness();
}
示例13: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Teacher::create(['name' => $faker->firstName, 'lastName' => $faker->lastName, 'dob' => $faker->date(), 'pob' => $faker->city, 'gender' => $faker->word, 'email' => $faker->email, 'password' => Hash::make('buffer'), 'grade' => $faker->word]);
}
}
示例14: actionView
public function actionView($id)
{
$lesson = $this->loadModel($id);
$userId = $this->_cookiesGet('userId');
$userType = $this->_cookiesGet('userType');
$this->_seoTitle = '课程 - ' . $lesson->name;
//取报名人数
$actual_students_criteria = new CDbCriteria();
$actual_students = StudentLesson::model()->count($actual_students_criteria->addCondition("lesson_id =" . $id));
$lesson->actual_students = $actual_students;
$teacher = Teacher::model()->findByPk($lesson->teacher_id);
$place = Place::model()->findByPk($lesson->place_id);
//教学环境图片显示
$imageList = $this->_gets->getParam('imageList');
$imageListSerialize = XUtils::imageListSerialize($imageList);
//判断学员已收藏的课程
if ($userType === 'student') {
$is_focus = StudentLesson::model()->findByAttributes(array('student_id' => $userId, 'lesson_id' => $id, 'is_collection' => 1));
}
if ($imageList) {
$imageList = $imageListSerialize['data'];
} elseif ($place->pic_other) {
$imageList = unserialize($place->pic_other);
}
$this->render('view', array('is_focus' => $is_focus, 'isJoin' => $this->isJoin($userId, $id, 1), 'userType' => $userType, 'lesson' => $lesson, 'place' => $place, 'teacher' => $teacher, 'imageList' => $imageList));
}
示例15: getModel
private function getModel()
{
if (!$this->isGuest && $this->_model === null) {
$this->_model = Teacher::model()->findByPk($this->id, array('select' => 'role'));
}
return $this->_model;
}