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


PHP Component::getDBConvert方法代码示例

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


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

示例1: sendComponentDefinitions

 /**
  * Initializes all components, with the data, which can be found in database.
  */
 public function sendComponentDefinitions()
 {
     $this->_app->response->setStatus(200);
     // starts a query
     ob_start();
     eval("?>" . file_get_contents(dirname(__FILE__) . '/Sql/GetComponentDefinitions.sql'));
     $sql = ob_get_contents();
     ob_end_clean();
     $result = DBRequest::request($sql, false, parse_ini_file(dirname(__FILE__) . '/config.ini', TRUE));
     // checks the correctness of the query
     if ((!isset($result['errno']) || !$result['errno']) && $result['content']) {
         $data = DBJson::getRows($result['content']);
         $Components = DBJson::getObjectsByAttributes($data, Component::getDBPrimaryKey(), Component::getDBConvert());
         $Links = DBJson::getObjectsByAttributes($data, Link::getDBPrimaryKey(), Link::getDBConvert());
         $objects = DBJson::concatResultObjectLists($data, $Components, Component::getDBPrimaryKey(), Component::getDBConvert()['CO_links'], $Links, Link::getDBPrimaryKey());
         $request = new Request_MultiRequest();
         $data = parse_ini_file(dirname(__FILE__) . '/config.ini', TRUE);
         $tempObjects = array();
         foreach ($objects as $object) {
             $object = Component::decodeComponent(json_encode($object));
             // prüfen, welche Komponente auf diesem Server ist
             if (strpos($object->getAddress() . '/', $data['PL']['urlExtern'] . '/') === false) {
                 continue;
             }
             $object->setAddress($data['PL']['url'] . substr($object->getAddress(), strlen($data['PL']['urlExtern'])));
             $links = $object->getLinks();
             foreach ($links as &$link) {
                 if (strpos($link->getAddress() . '/', $data['PL']['urlExtern'] . '/') === false) {
                     continue;
                 }
                 $link->setAddress($data['PL']['url'] . substr($link->getAddress(), strlen($data['PL']['urlExtern'])));
             }
             $object->setLinks($links);
             $result = Request_CreateRequest::createPost($object->getAddress() . '/control', array(), Component::encodeComponent($object));
             $tempObjects[] = $object;
             $request->addRequest($result);
         }
         $results = $request->run();
         $objects = $tempObjects;
         $i = 0;
         $res = array();
         foreach ($objects as $object) {
             $object = Component::decodeComponent(Component::encodeComponent($object));
             $result = $results[$i++];
             $newObject = new Component();
             $newObject->setId($object->getId());
             $newObject->setName($object->getName());
             $newObject->setAddress($object->getAddress());
             $newObject->setDef($object->getDef());
             $newObject->setStatus($result['status']);
             $res[] = $newObject;
             if ($result['status'] != 201) {
                 $add = '';
                 $this->_app->response->setStatus(409);
                 if (isset($result['content'])) {
                     $add = $result['content'];
                 }
                 Logger::Log($result['status'] . '--' . $object->getName() . '--' . $object->getAddress() . "\n" . $add . "\n", LogLevel::ERROR);
             }
         }
         $this->_app->response->setBody(json_encode($res));
     } else {
         Logger::Log('GET SendComponentDefinitions failed', LogLevel::ERROR);
         $this->_app->response->setStatus(isset($result['status']) ? $result['status'] : 409);
     }
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:69,代码来源:CControl.php

示例2: ExtractProcess

 public static function ExtractProcess($data, $singleResult = false, $ProcessExtension = '', $ComponentExtension = '', $ExerciseExtension = '', $isResult = true)
 {
     // generates an assoc array of processes by using a defined list of
     // its attributes
     $process = DBJson::getObjectsByAttributes($data, Process::getDBPrimaryKey(), Process::getDBConvert(), $ProcessExtension);
     // generates an assoc array of components by using a defined
     // list of its attributes
     $component = DBJson::getObjectsByAttributes($data, Component::getDBPrimaryKey(), Component::getDBConvert(), $ComponentExtension);
     // generates an assoc array of exercises by using a defined
     // list of its attributes
     $exercise = DBJson::getObjectsByAttributes($data, Exercise::getDBPrimaryKey(), Exercise::getDBConvert(), $ExerciseExtension);
     $attachment = Attachment::extractAttachment($data, false, '_PRO1', '_PRO1', false);
     $workFiles = Attachment::extractAttachment($data, false, '_PRO2', '_PRO2', false);
     // concatenates the processes and the associated attachments
     $process = DBJson::concatObjectListResult($data, $process, Process::getDBPrimaryKey(), Process::getDBConvert()['A_attachment'], $attachment, Attachment::getDBPrimaryKey(), '_PRO1', $ProcessExtension);
     // concatenates the processes and the associated attachments
     $process = DBJson::concatObjectListResult($data, $process, Process::getDBPrimaryKey(), Process::getDBConvert()['A_workFiles'], $workFiles, Attachment::getDBPrimaryKey(), '_PRO2', $ProcessExtension);
     // concatenates the processes and the associated components
     $process = DBJson::concatObjectListsSingleResult($data, $process, Process::getDBPrimaryKey(), Process::getDBConvert()['E_exercise'], $exercise, Exercise::getDBPrimaryKey(), $ExerciseExtension, $ProcessExtension);
     $res = DBJson::concatObjectListsSingleResult($data, $process, Process::getDBPrimaryKey(), Process::getDBConvert()['CO_target'], $component, Component::getDBPrimaryKey(), $ComponentExtension, $ProcessExtension);
     if ($isResult) {
         // to reindex
         $res = array_values($res);
         $res = Process::decodeProcess($res, false);
         if ($singleResult == true) {
             // only one object as result
             if (count($res) > 0) {
                 $res = $res[0];
             }
         }
     }
     return $res;
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:33,代码来源:Process.php


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