本文整理汇总了PHP中Course::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::select方法的具体用法?PHP Course::select怎么用?PHP Course::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course::select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteIfNotFound
/**
* If no training associations, delete course.
*/
public static function deleteIfNotFound($training_title_option_id, $training_id = 0)
{
$tableObj = new Course();
$select = $tableObj->select()->from('training', array('COUNT(id) AS training_count'))->setIntegrityCheck(false)->where("course_id = {$training_title_option_id} AND id != {$training_id}");
$row = $tableObj->fetchRow($select);
if (!$row->training_count) {
$tableObj = new Course();
$tableObj->delete("training_title_option_id = {$training_title_option_id}");
$tableObj = new ITechTable(array('name' => 'training_title_option'));
$tableObj->delete("id = {$training_title_option_id}");
}
}
示例2: Course
<?php
include_once $CFG->dirroot . "/lib/classes/" . "application/Course.Class.php5";
$courseObj = new Course();
$GeneralObj->getRequestVars();
$mode = $_REQUEST['mode'];
if ($mode == "Update") {
$courseObj->select($iCourseId);
$courseObj->getAllVar();
if ($dCourseDateTime != "0000-00-00 00:00:00") {
$iStarttime = date("H", strtotime($dCourseDateTime));
$iStartTimeMM = date("i", strtotime($dCourseDateTime));
$dCourseDateTime = substr($dCourseDateTime, 0, 10);
}
if ($iStarttime > 12) {
$iStarttime = $iStarttime - 12;
$SAMPM = "PM";
} else {
$SAMPM = "AM";
}
} else {
$mode = "Add";
}
if ($file != '') {
$link = "index.php?file=" . $file . "&mode=" . $mode . "&listfile=" . $listfile;
}
$section = "Courses";
$TOP_HEADER = $mode . ' ' . $section;
if ($mode == 'Update') {
$TOP_HEADER .= ' [' . $vCoursename . ']';
}
示例3: sortDataCourseJson
public function sortDataCourseJson()
{
ini_set('max_execution_time', 600000000);
$listCourse = Course::select('id', 'name', 'desc', 'subject', 'word')->get();
$size = count($listCourse);
for ($i = 0; $i < $size; $i++) {
$course = $listCourse[$i];
$subject = Subject::where('id_course', $course->id)->count();
$word = Word::where('id_course', $course->id)->count();
Course::where('id', $course->id)->update(array('subject' => $subject, 'word' => $word));
}
try {
$strListCourse = json_encode(Course::select('id', 'name', 'desc', 'subject', 'word', 'status', 'srclang', 'deslang')->where('status', 1)->get());
$fileNameCourse = public_path() . '/AllData/courses.json';
$fileCourse = fopen($fileNameCourse, "w");
if (fwrite($fileCourse, $strListCourse)) {
fclose($fileCourse);
return Redirect::back()->with('notify', 'Xuất dữ liệu thành công');
} else {
fclose($fileCourse);
return Redirect::back()->with('error', 'Có lỗi trong quá trình xuất dữ liệu');
}
} catch (Exception $e) {
return Redirect::back()->with('error', 'Có lỗi trong quá trình xuất dữ liệu');
}
}