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


PHP Course::findBySQL方法代码示例

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


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

示例1: searchSeminar

 /**
  * Finds all seminars by given search string. Searches for the name of
  * existing or already deleted seminars.
  * 
  * @param string $needle The needle to search for.
  * @return array 
  */
 public static function searchSeminar($needle)
 {
     $result = array();
     // search for active seminars
     $courses = Course::findBySQL("VeranstaltungsNummer LIKE CONCAT('%', :needle, '%')\n                     OR seminare.Name LIKE CONCAT('%', :needle, '%')", array(':needle' => $needle));
     foreach ($courses as $course) {
         $title = sprintf('%s %s (%s)', $course->VeranstaltungsNummer, my_substr($course->name, 0, 40), $course->start_semester->name);
         $result[] = array($course->getId(), $title);
     }
     // search deleted seminars
     // SemName and Number is part of info field, old id (still in DB) is in affected column
     $log_action_ids_archived_seminar = SimpleORMapCollection::createFromArray(LogAction::findBySQL("name IN ('SEM_ARCHIVE', 'SEM_DELETE_FROM_ARCHIVE')"))->pluck('action_id');
     $log_events_archived_seminar = LogEvent::findBySQL("info LIKE CONCAT('%', ?, '%')\n                AND action_id IN (?) ", array($needle, $log_action_ids_archived_seminar));
     foreach ($log_events_archived_seminar as $log_event) {
         $title = sprintf('%s (%s)', my_substr($log_event->info, 0, 40), _('gelöscht'));
         $result[] = array($log_event->affected_range_id, $title);
     }
     return $result;
 }
开发者ID:ratbird,项目名称:hope,代码行数:26,代码来源:StudipLog.class.php

示例2: getDozentSeminars

 /**
  * Creates an array with all seminars
  *
  * @return array
  */
 function getDozentSeminars()
 {
     $semester = $courses = array();
     $semester[] = Semester::findNext();
     $semester[] = Semester::findCurrent();
     $semester[] = Semester::findByTimestamp(Semester::findCurrent()->beginn - 1);
     if (Config::get()->IMPORTANT_SEMNUMBER) {
         $field = 'veranstaltungsnummer';
     } else {
         $field = 'name';
     }
     $allcourses = new SimpleCollection(Course::findBySQL("INNER JOIN seminar_user USING(Seminar_id) WHERE user_id=? AND seminar_user.status='dozent' AND seminare.visible=1", array($this->current_user->id)));
     foreach (array_filter($semester) as $one) {
         $courses[$one->name] = $allcourses->filter(function ($c) use($one) {
             return $c->start_time <= $one->beginn && ($one->beginn <= $c->start_time + $c->duration_time || $c->duration_time == -1);
         })->orderBy($field);
         if (!$courses[$one->name]->count()) {
             unset($courses[$one->name]);
         }
     }
     return $courses;
 }
开发者ID:ratbird,项目名称:hope,代码行数:27,代码来源:ProfileModel.php

示例3: add_to_course_action

 public function add_to_course_action($material_id)
 {
     $this->material = new LernmarktplatzMaterial($material_id);
     if (Request::isPost() && Request::option("seminar_id") && $GLOBALS['perm']->have_studip_perm("autor", Request::option("seminar_id"))) {
         //$course = new Course(Request::option("seminar_id"));
         $query = "SELECT folder_id FROM folder WHERE range_id = ? ORDER BY name";
         $statement = DBManager::get()->prepare($query);
         $statement->execute(array(Request::option("seminar_id")));
         $folder_id = $statement->fetch(PDO::FETCH_COLUMN, 0);
         if ($folder_id && ($GLOBALS['perm']->have_studip_perm("tutor", Request::option("seminar_id")) || in_array("writable", DocumentFolder::find($folder_id)->getPermissions()))) {
             if ($this->material['host_id']) {
                 $path = $GLOBALS['TMP_PATH'] . "/tmp_download_" . md5(uniqid());
                 file_put_contents($path, file_get_contents($this->material->host->url . "download/" . $this->material['foreign_material_id']));
             } else {
                 $path = $this->material->getFilePath();
             }
             $document = StudipDocument::createWithFile($path, array('name' => $this->material['name'], 'range_id' => $folder_id, 'user_id' => $GLOBALS['user']->id, 'seminar_id' => Request::option("seminar_id"), 'description' => $this->material['description'] ?: $this->material['short_description'], 'filename' => $this->material['filename'], 'filesize' => filesize($path), 'author_name' => get_fullname()));
             PageLayout::postMessage(MessageBox::success(_("Datei wurde erfolgreich kopiert.")));
             $this->redirect(URLHelper::getURL("folder.php#anker", array('cid' => Request::option("seminar_id"), 'data' => array('cmd' => "tree", 'open' => array($folder_id => 1, $document->getId() => 1)), 'open' => $document->getId())));
             if ($this->material['host_id']) {
                 //cleanup
                 @unlink($path);
             }
         } else {
             PageLayout::postMessage(MessageBox::error(_("Veranstaltung hat keinen allgemeinen Dateiordner.")));
             $this->redirect(PluginEngine::getURL($this->plugin, array(), "market/details/" . $material_id));
         }
     }
     $this->courses = Course::findBySQL("INNER JOIN seminar_user USING (Seminar_id) WHERE seminar_user.user_id = ? ORDER BY seminare.mkdate DESC", array($GLOBALS['user']->id));
 }
开发者ID:Krassmus,项目名称:LehrMarktplatz,代码行数:30,代码来源:market.php


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