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


PHP Course::getById方法代码示例

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


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

示例1: getList

 public function getList($order = "didascalia")
 {
     $order = trim(filter_var($order, FILTER_SANITIZE_STRING));
     //interrogazione tabella
     $sql = "SELECT * FROM upload ORDER BY {$order}";
     $auth = $this->connector->query($sql);
     $list = array();
     // controllo sul risultato dell'interrogazione
     if (mysql_num_rows($auth) > 0) {
         $doc = new Document();
         $doc->setConnector($this->connector);
         $course = new Course();
         $course->setConnector($this->connector);
         while ($res = $this->connector->getObjectResult($auth)) {
             $doc = new Document($res->id, $res->path, $res->tipo, $res->didascalia);
             //Calcolo le informazioni di servizio
             if ($res->tipo == 1) {
                 $doc->course_name = "TUTTI";
             } else {
                 $doc->course_name = $course->getById($res->tipo)->name;
             }
             $list[] = $doc;
         }
     }
     return $list;
 }
开发者ID:christian-rizza,项目名称:sis-portal,代码行数:26,代码来源:Document.php

示例2: getById

 public function getById($id)
 {
     $id = (int) $id;
     $sql = "SELECT * FROM piani WHERE id_piano='{$id}' LIMIT 1";
     $auth = $this->connector->query($sql);
     if (mysql_num_rows($auth) > 0) {
         //Inializzo le classi di servizio
         $course = new Course();
         $course->setConnector($this->connector);
         $subjectPlan = new SubjectPlan();
         $subjectPlan->setConnector($this->connector);
         $res = $this->connector->getObjectResult($auth);
         //Recupero la lista delle entries
         $sub_list = $subjectPlan->getList($res->id_piano, "anno");
         $plan = new Plan($res->id_piano, $res->codice, $res->id_corso, $sub_list);
         //Calcolo le informazioni di servizio
         $plan->course_name = $course->getById($plan->course_id)->name;
         //ritorno il piano cercato
         return $plan;
     }
     return false;
 }
开发者ID:christian-rizza,项目名称:sis-portal,代码行数:22,代码来源:Plan.php

示例3: getById

 public function getById($id)
 {
     // interrogazione della tabella
     $sql = "SELECT * FROM studenti WHERE id_studente='{$id}'";
     $auth = $this->connector->query($sql);
     $student = null;
     if (mysql_num_rows($auth) > 0) {
         $res = $this->connector->getObjectResult($auth);
         $student = new Student(get_object_vars($res));
     }
     //Gestisco i dati di servizio
     $plan = new Plan();
     $plan->setConnector($this->connector);
     $student_plan = $plan->getById($student->id_plan);
     $student->course_id = $student_plan->course_id;
     $course = new Course();
     $course->setConnector($this->connector);
     $student_course = $course->getById($student->course_id);
     $student->course_name = $student_course->name;
     $student->course_year = $student_course->years;
     return $student;
 }
开发者ID:christian-rizza,项目名称:sis-portal,代码行数:22,代码来源:Student.php

示例4: showCourse

function showCourse()
{
    global $connector;
    $page = "course.php";
    $course = new Course();
    $course->setConnector($connector);
    if ($_POST['operation']) {
        list($operation, $params) = explode("#", $_POST['operation']);
        switch ($operation) {
            case 'saveChanges':
                $course->storeFormValues($_POST);
                $error_msg = $course->insert();
                if ($error_msg) {
                    $result['edit'] = $course;
                }
                break;
            case 'delete':
                $error_msg = $course->delete($params);
                break;
            case 'edit':
                $result['edit'] = $course->getById($params);
                break;
            case 'editChanges':
                $course->storeFormValues($_POST);
                $error_msg = $course->update();
                break;
            default:
                $error_msg = "Operazione non valida";
        }
        if ($error_msg != "") {
            $result["errorMessage"] = $error_msg;
        } elseif ($operation != 'edit') {
            $result["statusMessage"] = "Operazione completata!";
        }
    }
    if (isset($_POST['search'])) {
        $result["courses"] = $course->search($_POST['search']);
    } else {
        $result["courses"] = $course->getList();
    }
    $page = "course.php";
    include_once BASE_PATH . "template.php";
}
开发者ID:christian-rizza,项目名称:sis-portal,代码行数:43,代码来源:index.php


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