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


PHP Course::ExtractCourse方法代码示例

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


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

示例1: get

 public function get($functionName, $linkName, $params = array(), $singleResult = false, $checkSession = true)
 {
     // in diesem Beispiel wird der Name, welcher in der Commands.json für diesen Funktionsaufruf angegeben wurde,
     // direkt Verwendet, um einen gleichnamigen Ausgang der Component.json anzusprechen und den dort
     // angegeben Aufruf auzulösen (wobei courseid entsprechend ersetzt wird)
     // diese Funktion soll aufgerufen werden, wenn unsere Anfrage an die Datenbank positiv war
     $positive = function ($input, $singleResult) {
         $result = Model::isEmpty();
         $result['content'] = array();
         foreach ($input as $inp) {
             if ($inp->getNumRows() > 0) {
                 // extract course data from db answer
                 $result['content'] = array_merge($result['content'], Course::ExtractCourse($inp->getResponse(), $singleResult));
                 $result['status'] = 200;
             }
         }
         return $result;
     };
     // hier wird eine MySql stored-procedure aufgerufen
     // dabei haben die aufzurufen Befehle die Form /funktionsname/:idA/:idB  (stehen in der Component.json)
     // dabei werden idA und idB durch die Werte in $params ersetzt Bsp.: $params = array("idA"=>2, "idB"=>3)
     $params = DBJson::mysql_real_escape_string($params);
     return $this->_component->call($linkName, $params, '', 200, $positive, array($singleResult), 'Model::isProblem', array(), 'Query');
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:24,代码来源:DBBeispiel.php

示例2: addSetting

 /**
  * Adds an Setting.
  */
 public function addSetting($pre = '', $courseid)
 {
     $this->loadConfig($pre);
     $pre = ($pre === '' ? '' : '_') . $pre;
     Logger::Log('starts POST AddSetting', LogLevel::DEBUG);
     // decode the received Setting data, as an object
     $insert = Setting::decodeSetting($this->_app->request->getBody());
     // always been an array
     $arr = true;
     if (!is_array($insert)) {
         $insert = array($insert);
         $arr = false;
     }
     $courseid = DBJson::mysql_real_escape_string($courseid);
     $pre = DBJson::mysql_real_escape_string($pre);
     // this array contains the indices of the inserted objects
     $res = array();
     foreach ($insert as $in) {
         // generates the insert data for the object
         $data = $in->getInsertData();
         // starts a query, by using a given file
         $result = DBRequest::getRoutedSqlFile($this->query, dirname(__FILE__) . '/Sql/AddSetting.sql', array('object' => $in, 'pre' => $pre, 'courseid' => $courseid));
         // checks the correctness of the query
         if ($result['status'] >= 200 && $result['status'] <= 299) {
             $queryResult = Query::decodeQuery($result['content']);
             // sets the new auto-increment id
             $obj = new Setting();
             $course = Course::ExtractCourse($queryResult[count($queryResult) - 1]->getResponse(), true);
             $insertId = $queryResult[count($queryResult) - 2]->getInsertId();
             if ($insertId == 0 && $in->getId() > 0) {
                 $insertId = Setting::getIdFromSettingId($in->getId());
             }
             if ($insertId != 0) {
                 $obj->setId($course->getId() . '_' . $insertId);
             }
             $res[] = $obj;
             $this->_app->response->setStatus(201);
             if (isset($result['headers']['Content-Type'])) {
                 $this->_app->response->headers->set('Content-Type', $result['headers']['Content-Type']);
             }
         } else {
             Logger::Log('POST AddSetting failed', LogLevel::ERROR);
             $this->_app->response->setStatus(isset($result['status']) ? $result['status'] : 409);
             $this->_app->response->setBody(Setting::encodeSetting($res));
             $this->_app->stop();
         }
     }
     if (!$arr && count($res) == 1) {
         $this->_app->response->setBody(Setting::encodeSetting($res[0]));
     } else {
         $this->_app->response->setBody(Setting::encodeSetting($res));
     }
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:56,代码来源:DBSetting.php

示例3: add

 public function add($name = '', $id, $idName, $functionName, $sqlFile)
 {
     $this->loadConfig($name);
     $name = ($name === '' ? '' : '_') . $name;
     Logger::Log('starts ' . $functionName, LogLevel::DEBUG);
     // decode the received attachment data, as an object
     $insert = Transaction::decodeTransaction($this->_app->request->getBody());
     // always been an array
     $arr = true;
     if (!is_array($insert)) {
         $insert = array($insert);
         $arr = false;
     }
     $name = DBJson::mysql_real_escape_string($name);
     $id = DBJson::mysql_real_escape_string($id);
     $uuid = new uuid();
     // this array contains the indices of the inserted objects
     $res = array();
     foreach ($insert as $in) {
         $random = str_replace('-', '', $uuid->get());
         $in->setTransactionId(null);
         // generates the insert data for the object
         $data = $in->getInsertData();
         // starts a query, by using a given file
         $result = DBRequest::getRoutedSqlFile($this->query, $sqlFile, array('object' => $in, 'name' => $name, $idName => $id, 'random' => $random));
         // checks the correctness of the query
         if ($result['status'] >= 200 && $result['status'] <= 299) {
             $queryResult = Query::decodeQuery($result['content']);
             // sets the new auto-increment id
             $obj = new Transaction();
             $course = Course::ExtractCourse($queryResult[count($queryResult) - 1]->getResponse(), true);
             $obj->setTransactionId($course->getId() . '_' . $queryResult[count($queryResult) - 2]->getInsertId() . '_' . $random);
             $res[] = $obj;
             $this->_app->response->setStatus(201);
             if (isset($result['headers']['Content-Type'])) {
                 $this->_app->response->headers->set('Content-Type', $result['headers']['Content-Type']);
             }
         } else {
             Logger::Log($functionName . ' failed', LogLevel::ERROR);
             $this->_app->response->setStatus(isset($result['status']) ? $result['status'] : 409);
             $this->_app->response->setBody(Transaction::encodeTransaction($res));
             $this->_app->stop();
         }
     }
     if (!$arr && count($res) == 1) {
         $this->_app->response->setBody(Transaction::encodeTransaction($res[0]));
     } else {
         $this->_app->response->setBody(Transaction::encodeTransaction($res));
     }
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:50,代码来源:DBTransaction.php

示例4: get

 public function get($functionName, $linkName, $params = array(), $checkSession = true)
 {
     $positive = function ($input) {
         $result = Model::isEmpty();
         $result['content'] = array();
         foreach ($input as $inp) {
             if ($inp->getNumRows() > 0) {
                 // extract Course data from db answer
                 $res = Course::ExtractCourse($inp->getResponse(), false);
                 $result['content'] = array_merge($result['content'], is_array($res) ? $res : array($res));
                 $result['status'] = 200;
             }
         }
         return $result;
     };
     $params = DBJson::mysql_real_escape_string($params);
     return $this->_component->call($linkName, $params, '', 200, $positive, array(), 'Model::isProblem', array(), 'Query');
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:18,代码来源:DBCourse.php

示例5: addProcess

 /**
  * Adds a process.
  *
  * Called when this component receives an HTTP POST request to
  * (/$pre)/process(/).
  *
  * @param int $pre A optional prefix for the process table.
  */
 public function addProcess($pre = '')
 {
     $this->loadConfig($pre);
     $pre = ($pre === '' ? '' : '_') . $pre;
     Logger::Log('starts POST AddProcess', LogLevel::DEBUG);
     // decode the received choice data, as an object
     $insert = Process::decodeProcess($this->_app->request->getBody());
     // always been an array
     $arr = true;
     if (!is_array($insert)) {
         $insert = array($insert);
         $arr = false;
     }
     // this array contains the indices of the inserted objects
     $res = array();
     foreach ($insert as $in) {
         // starts a query, by using a given file
         $result = DBRequest::getRoutedSqlFile($this->query, dirname(__FILE__) . '/Sql/AddProcess.sql', array('object' => $in, 'pre' => $pre));
         // checks the correctness of the query
         if ($result['status'] >= 200 && $result['status'] <= 299) {
             $queryResult = Query::decodeQuery($result['content']);
             // sets the new auto-increment id
             $obj = new Process();
             $course = Course::ExtractCourse($queryResult[count($queryResult) - 1]->getResponse(), true);
             $obj->setProcessId($course->getId() . '_' . $queryResult[count($queryResult) - 2]->getInsertId());
             $res[] = $obj;
             $this->_app->response->setStatus(201);
             if (isset($result['headers']['Content-Type'])) {
                 $this->_app->response->headers->set('Content-Type', $result['headers']['Content-Type']);
             }
         } else {
             Logger::Log('POST AddProcess failed', LogLevel::ERROR);
             $this->_app->response->setStatus(isset($result['status']) ? $result['status'] : 409);
             $this->_app->response->setBody(Process::encodeProcess($res));
             $this->_app->stop();
         }
     }
     if (!$arr && count($res) == 1) {
         $this->_app->response->setBody(Process::encodeProcess($res[0]));
     } else {
         $this->_app->response->setBody(Process::encodeProcess($res));
     }
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:51,代码来源:DBProcess.php


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