本文整理汇总了PHP中Lesson类的典型用法代码示例。如果您正苦于以下问题:PHP Lesson类的具体用法?PHP Lesson怎么用?PHP Lesson使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Lesson类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: register
function register(Lesson $lesson)
{
// do something with this Lesson
// now tell someone
$notifier = Notifier::getNotifier();
$notifier->inform("new lesson: cost ({$lesson->cost()})");
}
开发者ID:jabouzi,项目名称:projet,代码行数:7,代码来源:listing3.php
示例2: slide_presentation_lesson
function slide_presentation_lesson(Lesson $lesson, $name)
{
global $tr;
$manageCourse = new CourseManager();
$c = $manageCourse->getById($lesson->getCourseId());
return "<div class='sp-presentation-content'>\r\n <div>\r\n <h4><strong>" . $tr->__("Author") . "</strong>: " . $name . "</h4>\r\n <h4><strong>" . $tr->__("Course") . "</strong>: " . $c->getName() . "</h4>\r\n <h4><strong>" . $tr->__("Duration") . "</strong>: " . $lesson->getDuration() . " min</h4>\r\n </div>\r\n <h2>" . $lesson->getName() . "</h2>\r\n\r\n </div>";
}
开发者ID:Cossumo,项目名称:studypress,代码行数:7,代码来源:player-lesson.controller.php
示例3: register
public function register(Lesson $lesson)
{
// marking registration
// ...
// notify
$notifier = Notifier::getNotifier();
$notifier->inform("new lesson. cost = {$lesson->cost()}");
}
开发者ID:Codealist,项目名称:patterns,代码行数:8,代码来源:reg.php
示例4: addLesson
function addLesson($lesson_title, $lesson_parent_id = 0)
{
$lesson_object = new Lesson();
$lesson_object->setTitle($lesson_title)->setIsRoot(!$lesson_parent_id)->save();
if ($lesson_parent_id) {
$lesson_parent_object = new LessonParent();
$lesson_parent_object->setLessonId($lesson_object->getId())->setParentId($lesson_parent_id)->save();
}
return $lesson_object->getId();
}
开发者ID:arneau,项目名称:defender-app,代码行数:10,代码来源:lessons.php
示例5: actionCreate
/**
* 录入
*
*/
public function actionCreate()
{
parent::_acl();
$model = new Lesson();
if (isset($_POST['Lesson'])) {
$acl = $this->_gets->getPost('acl');
$model->attributes = $_POST['Lesson'];
if ($model->save()) {
AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入内容,ID:' . $model->id));
$this->redirect(array('index'));
}
}
$this->render('lesson_create', array('model' => $model));
}
开发者ID:tecshuttle,项目名称:51qsk,代码行数:18,代码来源:LessonController.php
示例6: makeLesson
/**
* @param array $lessonFields
*/
protected function makeLesson($lessonFields = [])
{
$lesson = array_merge(['title' => $this->fake->sentence, 'body' => $this->fake->paragraph, 'some_bool' => $this->fake->boolean], $lessonFields);
while ($this->times--) {
Lesson::create($lesson);
}
}
开发者ID:richardmalkuth,项目名称:laravel-incremental-api,代码行数:10,代码来源:ApiTester.php
示例7: beforeSave
public function beforeSave()
{
if (!$this->weight || !$this->number) {
$criteria = new CDbCriteria();
$criteria->condition = "courseId=" . intval($this->courseId);
$criteria->select = "max(weight) as maxWeight,max(number) as maxNumber";
$chapter = self::model()->find($criteria);
$lesson = Lesson::model()->find($criteria);
}
if (!$this->weight) {
if (!$chapter && !$lesson) {
$this->weight = 1;
} else {
if (!$lesson) {
$this->weight = $chapter->maxWeight + 1;
} elseif (!$chapter) {
$this->weight = $lesson->maxWeight + 1;
} else {
$this->weight = max(array($chapter->maxWeight, $lesson->maxWeight)) + 1;
}
}
}
if (!$this->number) {
if ($chapter) {
$this->number = $chapter->maxNumber + 1;
} else {
$this->number = 1;
}
}
return parent::beforeSave();
}
开发者ID:stan5621,项目名称:eduwind,代码行数:31,代码来源:Chapter.php
示例8: actionIndex
public function actionIndex()
{
Yii::app()->getModule('aud');
Yii::app()->getModule('group');
Yii::app()->getModule('lesson');
Yii::app()->getModule('sch');
Yii::app()->getModule('spec');
Yii::app()->getModule('teacher');
$schs = Sch::model()->findAll(array('order' => 'modified_time DESC', 'limit' => 100));
$auds = Aud::model()->findAll(array('order' => 'updated_time DESC', 'limit' => 100));
$specs = Spec::model()->findAll(array('order' => 'updated_time DESC', 'limit' => 100));
$groups = Group::model()->findAll(array('order' => 'updated_time DESC', 'limit' => 100));
$lessons = Lesson::model()->findAll(array('order' => 'updated_time DESC', 'limit' => 100));
$teachers = Teacher::model()->findAll(array('order' => 'updated_time DESC', 'limit' => 100));
$entries = $this->addEntries(array($auds, $specs, $groups, $lessons, $teachers));
foreach ($schs as $value) {
$entries[] = array('id' => $value->group_id, 'module' => strtolower(get_class($value)), 'time' => $value->modified_time . rand(100000, 999999), 'time' => $value->modified_time, 'user' => $value->modified_by, 'action' => 'update');
}
$entriesNew = array();
foreach ($entries as $value) {
$entriesNew[$value['time'] . rand(10000, 99999)] = $value;
}
krsort($entriesNew);
$this->render('index', array('entries' => $entriesNew));
}
开发者ID:BigMacckk,项目名称:kepsch,代码行数:25,代码来源:ActivityController.php
示例9: actionHome
/**
* 主界面
*/
public function actionHome()
{
//查询课程
$lessons = Lesson::model()->findAll(array('select' => array('catalog_id', 'arrivals', 'price')));
//学员活跃度
$studentAllCount = Student::model()->count();
$criteria = new CDbCriteria();
$criteria->distinct = true;
$criteria->addCondition('is_pays=:is_pay');
$criteria->params[':is_pay'] = 1;
$studentActiveCount = StudentLesson::model()->countBySql("SELECT COUNT(DISTINCT student_id) FROM `seed_student_lesson` WHERE is_pay=:is_pay", array(':is_pay' => 1));
$studentPercentage = round($studentActiveCount / $studentAllCount * 100) . '%';
//获取课程分类数组
$catalogs = Catalog::model()->findAllByAttributes(array('parent_id' => 6));
$allCountLesson = Lesson::model()->count();
foreach ($catalogs as $catalog) {
//初始化
$lessonMoney[$catalog[id]] = 0;
$allLesson[$catalog[id]] = 0;
$catalogName[$catalog[catalog_name]] = $catalog[id];
//各分类中已报名课程和发布课程总量
$allLesson[$catalog[id]] = Lesson::model()->count("catalog_id=:catalog_id", array(":catalog_id" => $catalog[id]));
$applyLesson[$catalog[id]] = Lesson::model()->count("catalog_id=:catalog_id AND actual_students<>:actual_students", array(":catalog_id" => $catalog[id], ":actual_students" => 0));
}
//成交总金额
foreach ($lessons as $lesson) {
$lessonMoney[$lesson[catalog_id]] = (int) $lesson[arrivals] * (int) $lesson[price];
}
$this->render('home', array('catalogName' => json_encode($catalogName), 'lessonMoney' => json_encode($lessonMoney), 'allLesson' => json_encode($allLesson), 'applyLesson' => json_encode($applyLesson), 'studentPercentage' => $studentPercentage));
}
开发者ID:tecshuttle,项目名称:51qsk,代码行数:33,代码来源:DefaultController.php
示例10: actionGetSubjectSchedule
/**
* 日历课程接口
*/
public function actionGetSubjectSchedule()
{
if (!isset($_REQUEST['teacherId']) || !isset($_REQUEST['token']) || !isset($_REQUEST['date'])) {
$this->_return('MSG_ERR_LESS_PARAM');
}
$user_id = trim(Yii::app()->request->getParam('teacherId', null));
$token = trim(Yii::app()->request->getParam('token', null));
$date = trim(Yii::app()->request->getParam('date', null));
if (!ctype_digit($user_id)) {
$this->_return('MSG_ERR_FAIL_PARAM');
}
// 用户名不存在,返回错误
if ($user_id < 1) {
$this->_return('MSG_ERR_NO_USER');
}
// 验证日期格式合法
if (!$this->isDate($date)) {
$this->_return('MSG_ERR_FAIL_DATE_FORMAT');
}
$year = mb_substr($date, 0, 4, 'utf8');
$month = mb_substr($date, 5, 2, 'utf8');
$day = mb_substr($date, 8, 2, 'utf8');
if (empty($year) || empty($month) || empty($day)) {
$this->_return('MSG_ERR_FAIL_DATE_LESS');
}
// 验证token
if (Token::model()->verifyToken($user_id, $token)) {
// 获取日历课程
$data = Lesson::model()->getSubjectSchedule($user_id, $year, $month, $day, $date);
$this->_return('MSG_SUCCESS', $data);
} else {
$this->_return('MSG_ERR_TOKEN');
}
}
开发者ID:hucongyang,项目名称:student_cnhutong,代码行数:37,代码来源:LessonController.php
示例11: i
public static function i($id)
{
if (self::$i == NULL) {
self::$i = new Lesson($id);
}
return self::$i;
}
开发者ID:AlexOrfen,项目名称:Schedule,代码行数:7,代码来源:lesson.php
示例12: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 30) as $index) {
Lesson::create(['title' => $faker->sentence(5), 'body' => $faker->paragraph(4), 'some_bool' => $faker->boolean()]);
}
}
开发者ID:richardmalkuth,项目名称:laravel-incremental-api,代码行数:7,代码来源:LessonsTableSeeder.php
示例13: getAll
public function getAll()
{
$lessons = Lesson::all();
$episodes = Episode::all();
$lessons = $lessons->toBase()->merge($episodes);
return $lessons;
}
开发者ID:sabahtalateh,项目名称:laracast,代码行数:7,代码来源:Catalog.php
示例14: Lesson
public static function Lesson($type, $data)
{
require_once 'lesson.class.php';
$class = new Lesson();
$status = false;
$device = ManagementFunction::getPostVariable('device');
$number_device = ManagementFunction::getPostVariable('number_dv');
$class->setData($data);
$class->device = $device;
$class->number_device = $number_device;
switch ($type) {
case 'add':
$status = $class->add();
break;
case 'update':
$status = $class->update();
break;
case 'delete':
$status = $class->delete();
break;
case 'getsingle':
$status = $class->getsingle();
break;
case 'getpage':
$status = $class->getpage();
break;
case 'search':
$status = $class->search();
break;
case 'getlessondetail':
$status = $class->getLessonDetail();
break;
case 'dellessondetail':
$status = $class->delLessonDetail();
break;
case 'updatelessondetail':
$status = $class->updatelessondetail();
break;
case 'add-lesson-detail':
$status = $class->addlessondetail();
break;
case 'getroom':
$status = $class->getroom();
break;
case 'print':
$status = $class->print_data();
break;
default:
break;
}
if ($status) {
wp_send_json_success($status);
} else {
wp_send_json_error($class->error);
}
}
开发者ID:khiconit,项目名称:Device-manager,代码行数:56,代码来源:ManagementAdmin.class.php
示例15: loadModel
private function loadModel($id)
{
$model = Lesson::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
开发者ID:tecshuttle,项目名称:51qsk,代码行数:8,代码来源:LessonController.php
示例16: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
$lesson = Lesson::find($id);
if (!$lesson) {
return $this->respondNotFound('Lesson does not exist.');
}
return $this->respond(['data' => $this->lessonTransformer->transform($lesson)]);
}
开发者ID:richardmalkuth,项目名称:laravel-incremental-api,代码行数:14,代码来源:LessonsController.php
示例17: actionSubject
public function actionSubject()
{
$subject_id = "";
if (isset($_GET["subject_id"])) {
$subject_id = StringHelper::filterString($_GET["subject_id"]);
} else {
if (isset($_GET["subject_code"])) {
$subject_code = StringHelper::filterString($_GET["subject_code"]);
$subject_by_code = Subject::model()->findByAttributes(array('subject_code' => $subject_code));
$subject_id = $subject_by_code->subject_id;
}
}
$subjectCriteria = new CDbCriteria();
$subjectCriteria->select = "*";
$subjectCriteria->condition = "subject_id = :subject_id";
$subjectCriteria->params = array(":subject_id" => $subject_id);
$subject = Subject::model()->findAll($subjectCriteria);
$teachers = Teacher::model()->with(array("subject_teacher" => array("select" => false, "condition" => "subject_id = :subject_id", "params" => array(":subject_id" => $subject_id))))->findAll();
// $doc = Doc::model()->with(array("docs" => array(
// "select" => "*",
// "condition" => "subject_id = :subject_id and active = 1",
// "params" => array(":subject_id" => $subject_id)
// )))->findAll(array("limit" => "3", "order" => "RAND()"));
//
// $reference = Doc::model()->with(array("docs" => array(
// "select" => "*",
// "condition" => "subject_id = :subject_id and active = 0",
// "params" => array(":subject_id" => $subject_id)
// )))->findAll(array("limit" => "3", "order" => "RAND()"));
$lesson = Lesson::model()->findAll(array("select" => "*", "condition" => "lesson_subject = :lesson_subject", "params" => array(":lesson_subject" => $subject_id), "order" => "lesson_weeks ASC"));
// $doc_related = Doc::model()->with(array("docs" => array(
// "condition" => "subject_id = :subject_id",
// "params" => array(":subject_id" => $subject_id)
// )))->findAll();
// $sql = "SELECT * FROM tbl_doc JOIN tbl_subject_doc ON tbl_doc.doc_id = tbl_subject_doc.doc_id WHERE tbl_subject_doc.subject_id = " . $subject_id;
// $doc_related = Yii::app()->db->createCommand($sql)->query();
$criteria = new CDbCriteria();
$criteria->select = 't.*';
$criteria->join = 'JOIN tbl_subject_doc ON t.doc_id = tbl_subject_doc.doc_id';
$criteria->condition = 'tbl_subject_doc.subject_id = :value';
$criteria->params = array(":value" => $subject_id);
$doc_related = Doc::model()->findAll($criteria);
// $doc_related = SubjectDoc::model()->findAll(array(
// 'select' => '*',
// 'condition' => 'subject_id = :subject_id',
// 'params' => array(':subject_id' => $subject_id)));
foreach ($subject as $subject_detail) {
$title = $subject_detail->subject_name . " | Bluebee - UET";
$des = $subject_detail->subject_target;
}
$this->pageTitle = $title;
Yii::app()->clientScript->registerMetaTag($title, null, null, array('property' => 'og:title'));
Yii::app()->clientScript->registerMetaTag(Yii::app()->createAbsoluteUrl('listOfSubject/subject?subject_id=') . $subject_id, null, null, array('property' => 'og:url'));
Yii::app()->clientScript->registerMetaTag($des, null, null, array('property' => 'og:description'));
$category_father = Faculty::model()->findAll();
$subject_type = SubjectType::model()->findAll();
$this->render('subject', array('subject' => $subject, 'category_father' => $category_father, 'subject_type' => $subject_type, 'teacher' => $teachers, 'lesson' => $lesson, 'doc_related' => $doc_related));
}
开发者ID:huynt57,项目名称:bluebee-uet.com,代码行数:58,代码来源:ListOfSubjectController.php
示例18: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$lesson = Lesson::create(Input::all());
// Alternatively, fire and listen for an event
// Then, call this from the listener.
Notify::lessonSubscribers($lesson);
return 'Success';
// or redirect or whatever
}
开发者ID:billwaddyjr,项目名称:Email-Notifications-With-Mailchimp,代码行数:14,代码来源:LessonsController.php
示例19: actionCreate
/**
* 录入
*
*/
public function actionCreate()
{
parent::_acl();
$model = new Lesson();
if (isset($_POST['Lesson'])) {
$acl = $this->_gets->getPost('acl');
$model->attributes = $_POST['Lesson'];
$model->teacher_id = 88888888;
$model->check_status = 1;
$model->actual_students = 0;
$model->arrivals = 0;
if ($model->save()) {
AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入内容,ID:' . $model->id));
$this->redirect(array('index'));
}
}
$this->render('lessonRecommend_create', array('model' => $model));
}
开发者ID:tecshuttle,项目名称:51qsk,代码行数:22,代码来源:LessonRecommendController.php
示例20: run
public function run()
{
$faker = Faker::create();
$lessonIds = Lesson::lists('id');
$tagIds = Tag::lists('id');
foreach (range(1, 30) as $index) {
DB::table('lesson_tag')->insert(['lesson_id' => $faker->randomElement($lessonIds), 'tag_id' => $faker->randomElement($tagIds)]);
}
}
开发者ID:rudihartomo,项目名称:Laravel-RestAPI,代码行数:9,代码来源:LessontagTableSeeder.php
注:本文中的Lesson类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论