public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->param !== null) { $this->addInsertData($values, 'P_pa', DBJson::mysql_real_escape_string($this->param)); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->status != null) { $this->addInsertData($values, 'CS_status', DBJson::mysql_real_escape_string($this->status)); } if ($this->course != null && $this->course->getId() != null) { $this->addInsertData($values, 'C_id', DBJson::mysql_real_escape_string($this->course->getId())); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
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'); }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->transactionId != null) { $this->addInsertData($values, 'T_id', DBJson::mysql_real_escape_string($this->transactionId)); } if ($this->durability != null) { $this->addInsertData($values, 'T_durability', DBJson::mysql_real_escape_string($this->durability)); } if ($this->authentication != null) { $this->addInsertData($values, 'T_authentication', DBJson::mysql_real_escape_string($this->authentication)); } if ($this->content != null) { $this->addInsertData($values, 'T_content', DBJson::mysql_real_escape_string($this->content)); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->id !== null) { $this->addInsertData($values, 'SET_id', DBJson::mysql_real_escape_string(self::getIdFromSettingId($this->id))); } if ($this->name !== null) { $this->addInsertData($values, 'SET_name', DBJson::mysql_real_escape_string($this->name)); } if ($this->state !== null) { $this->addInsertData($values, 'SET_state', DBJson::mysql_real_escape_string($this->state)); } if ($this->type !== null) { $this->addInsertData($values, 'SET_type', DBJson::mysql_real_escape_string($this->state)); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
/** * Removes the component from a given course * * Called when this component receives an HTTP DELETE request to * /course/$courseid(/). * * @param string $courseid The id of the course. */ public function deleteCourse($courseid) { $this->app->response->setStatus(201); Logger::Log('starts DELETE DeleteCourse', LogLevel::DEBUG); $header = $this->app->request->headers->all(); $courseid = DBJson::mysql_real_escape_string($courseid); foreach ($this->_createCourse as $_link) { $result = Request::routeRequest('DELETE', '/course/' . $courseid, $header, '', $_link, 'course'); // checks the correctness of the query if ($result['status'] >= 200 && $result['status'] <= 299) { if (isset($result['headers']['Content-Type'])) { $this->app->response->headers->set('Content-Type', $result['headers']['Content-Type']); } } else { Logger::Log('POST DeleteCourse failed', LogLevel::ERROR); $this->app->response->setStatus(isset($result['status']) ? $result['status'] : 409); $this->app->stop(); } } }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->id !== null) { $this->addInsertData($values, 'S_id', DBJson::mysql_real_escape_string($this->id)); } if ($this->studentId !== null) { $this->addInsertData($values, 'U_id', DBJson::mysql_real_escape_string($this->studentId)); } if ($this->file != array() && $this->file !== null) { $this->addInsertData($values, 'F_id_file', DBJson::mysql_real_escape_string($this->file->getFileId())); } if ($this->exerciseId !== null) { $this->addInsertData($values, 'E_id', DBJson::mysql_real_escape_string($this->exerciseId)); } if ($this->comment !== null) { $this->addInsertData($values, 'S_comment', DBJson::mysql_real_escape_string($this->comment)); } if ($this->accepted !== null) { $this->addInsertData($values, 'S_accepted', DBJson::mysql_real_escape_string($this->accepted)); } if ($this->date !== null) { $this->addInsertData($values, 'S_date', DBJson::mysql_real_escape_string($this->date)); } // if ($this->selectedForGroup != null) $this->addInsertData($values, 'S_selected', DBJson::mysql_real_escape_string($this->selectedForGroup)); if ($this->flag !== null) { $this->addInsertData($values, 'S_flag', DBJson::mysql_real_escape_string($this->flag)); } if ($this->leaderId !== null) { $this->addInsertData($values, 'S_leaderId', DBJson::mysql_real_escape_string($this->leaderId)); } if ($this->hideFile !== null) { $this->addInsertData($values, 'S_hideFile', DBJson::mysql_real_escape_string($this->hideFile)); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
/** * Removes the component from a given course */ public function deleteCourse($pre = '', $courseid) { $this->loadConfig($pre); $pre = ($pre === '' ? '' : '_') . $pre; Logger::Log('starts DELETE DeleteCourse', LogLevel::DEBUG); $courseid = DBJson::mysql_real_escape_string($courseid); // starts a query, by using a given file $result = DBRequest::getRoutedSqlFile($this->query, dirname(__FILE__) . '/Sql/DeleteCourse.sql', array('courseid' => $courseid, 'pre' => $pre)); // checks the correctness of the query if ($result['status'] >= 200 && $result['status'] <= 299) { $this->_app->response->setStatus(201); $this->_app->response->setBody(''); if (isset($result['headers']['Content-Type'])) { $this->_app->response->headers->set('Content-Type', $result['headers']['Content-Type']); } } else { Logger::Log('DELETE DeleteCourse failed', LogLevel::ERROR); $this->_app->response->setStatus(isset($result['status']) ? $result['status'] : 409); $this->_app->response->setBody(''); $this->_app->stop(); } }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->id != null) { $this->addInsertData($values, 'EFT_id', DBJson::mysql_real_escape_string($this->id)); } if ($this->text != null) { $this->addInsertData($values, 'EFT_text', DBJson::mysql_real_escape_string($this->text)); } if ($this->exerciseId != null) { $this->addInsertData($values, 'E_id', DBJson::mysql_real_escape_string($this->exerciseId)); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
public function get($functionName, $linkName, $params = array(), $checkSession = true) { $positive = function ($input) { //$input = $input[count($input)-1]; $result = Model::isEmpty(); $result['content'] = array(); foreach ($input as $inp) { if ($inp->getNumRows() > 0) { // extract Invitation data from db answer $res = Invitation::ExtractInvitation($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'); }
/** * Returns a specific component definition. * * @param $componentid a database component identifier */ public function getComponentDefinition($componentid) { $componentid = DBJson::mysql_real_escape_string($componentid); // starts a query ob_start(); eval("?>" . file_get_contents(dirname(__FILE__) . '/Sql/GetComponentDefinition.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()); $result = DBJson::concatResultObjectLists($data, $Components, Component::getDBPrimaryKey(), Component::getDBConvert()['CO_links'], $Links, Link::getDBPrimaryKey()); if (count($result) > 0) { $this->_app->response->setBody(json_encode($result[0])); } $this->_app->response->setStatus(200); } else { Logger::Log('GET GetComponentDefinition failed', LogLevel::ERROR); $this->_app->response->setStatus(409); } }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->fileId !== null) { $this->addInsertData($values, 'F_id', DBJson::mysql_real_escape_string($this->fileId)); } if ($this->displayName !== null) { $this->addInsertData($values, 'F_displayName', DBJson::mysql_real_escape_string($this->displayName)); } if ($this->address !== null) { $this->addInsertData($values, 'F_address', DBJson::mysql_real_escape_string($this->address)); } if ($this->timeStamp !== null) { $this->addInsertData($values, 'F_timeStamp', DBJson::mysql_real_escape_string($this->timeStamp)); } if ($this->fileSize !== null) { $this->addInsertData($values, 'F_fileSize', DBJson::mysql_real_escape_string($this->fileSize)); } if ($this->hash !== null) { $this->addInsertData($values, 'F_hash', DBJson::mysql_real_escape_string($this->hash)); } if ($this->comment !== null) { $this->addInsertData($values, 'F_comment', DBJson::mysql_real_escape_string($this->comment)); } if ($this->mimeType !== null) { $this->addInsertData($values, 'F_mimeType', DBJson::mysql_real_escape_string($this->mimeType)); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
/** * Adds the component to a course * * Called when this component receives an HTTP POST request to * (/:preChoice(/:preForm(/:preExercise)))/course(/). * * @param int $preChoice A optional prefix for the Choice table. * @param int $preForm A optional prefix for the Form table. * @param int $preExercise A optional prefix for the Exercise table. */ public function addCourse($preChoice = '', $preForm = '', $preExercise = '') { $this->loadConfig($preChoice, $preForm, $preExercise); $preChoice = ($preChoice === '' ? '' : '_') . $preChoice; $preForm = ($preForm === '' ? '' : '_') . $preForm; $preExercise = ($preExercise === '' ? '' : '_') . $preExercise; Logger::Log('starts POST AddCourse', LogLevel::DEBUG); // decode the received course data, as an object $insert = Course::decodeCourse($this->_app->request->getBody()); $preChoice = DBJson::mysql_real_escape_string($preChoice); $preForm = DBJson::mysql_real_escape_string($preForm); $preExercise = DBJson::mysql_real_escape_string($preExercise); // 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/AddCourse.sql', array('object' => $in, 'preChoice' => $preChoice, 'preForm' => $preForm, 'preExercise' => $preExercise)); // checks the correctness of the query if ($result['status'] >= 200 && $result['status'] <= 299) { $queryResult = Query::decodeQuery($result['content']); $res[] = $in; $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 AddCourse failed', LogLevel::ERROR); $this->_app->response->setStatus(isset($result['status']) ? $result['status'] : 409); $this->_app->response->setBody(Course::encodeCourse($res)); $this->_app->stop(); } } if (!$arr && count($res) == 1) { $this->_app->response->setBody(Course::encodeCourse($res[0])); } else { $this->_app->response->setBody(Course::encodeCourse($res)); } }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->leaderId != null) { $this->addInsertData($values, 'U_id_leader', DBJson::mysql_real_escape_string($this->leaderId)); } if ($this->submissionId != null) { $this->addInsertData($values, 'S_id_selected', DBJson::mysql_real_escape_string($this->submissionId)); } if ($this->exerciseId != null) { $this->addInsertData($values, 'E_id', DBJson::mysql_real_escape_string($this->exerciseId)); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->id != null) { $this->addInsertData($values, 'CO_id', DBJson::mysql_real_escape_string($this->id)); } if ($this->name != null) { $this->addInsertData($values, 'CO_name', DBJson::mysql_real_escape_string($this->name)); } if ($this->address != null) { $this->addInsertData($values, 'CO_address', DBJson::mysql_real_escape_string($this->address)); } if ($this->option != null) { $this->addInsertData($values, 'CO_option', DBJson::mysql_real_escape_string($this->option)); } if ($this->def !== null && $this->def !== array()) { $this->addInsertData($values, 'CO_def', DBJson::mysql_real_escape_string($this->def)); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
public function getAmountOfExpiredTransactions($name = '', $courseid) { $this->loadConfig($name); $name = ($name === '' ? '' : '_') . $name; Logger::Log('starts GET GetAmountOfExpiredTransactions', LogLevel::DEBUG); $courseid = DBJson::mysql_real_escape_string($courseid); // starts a query, by using a given file $result = DBRequest::getRoutedSqlFile($this->query, dirname(__FILE__) . '/Sql/procedures/GetAmountOfExpiredTransactions.sql', array('courseid' => $courseid, 'name' => $name)); // checks the correctness of the query if ($result['status'] >= 200 && $result['status'] <= 299) { $query = Query::decodeQuery($result['content']); $result = $query->getResponse(); foreach ($result as &$res) { $res['component'] = $this->_conf->getName(); } $this->_app->response->setStatus(200); $this->_app->response->setBody(json_encode($result)); } else { Logger::Log('GET GetAmountOfExpiredTransactions failed', LogLevel::ERROR); $this->_app->response->setStatus(isset($result['status']) ? $result['status'] : 409); $this->_app->response->setBody(''); $this->_app->stop(); } }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->sheet != null) { $this->addInsertData($values, 'ES_id', DBJson::mysql_real_escape_string($this->sheet)); } if ($this->leader != null && $this->leader->getId() != null) { $this->addInsertData($values, 'U_id_member', DBJson::mysql_real_escape_string($this->leader->getId())); } if ($this->member != null && $this->member->getId() != null) { $this->addInsertData($values, 'U_id_leader', DBJson::mysql_real_escape_string($this->member->getId())); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->choiceId != null) { $this->addInsertData($values, 'CH_id', DBJson::mysql_real_escape_string(Choice::getIdFromChoiceId($this->choiceId))); } if ($this->formId != null) { $this->addInsertData($values, 'FO_id', DBJson::mysql_real_escape_string(Form::getIdFromFormId($this->formId))); } if ($this->text != null) { $this->addInsertData($values, 'CH_text', DBJson::mysql_real_escape_string($this->text)); } if ($this->correct != null) { $this->addInsertData($values, 'CH_correct', DBJson::mysql_real_escape_string($this->correct)); } if ($this->submissionId != null) { $this->addInsertData($values, 'S_id', DBJson::mysql_real_escape_string($this->submissionId)); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->id !== null) { $this->addInsertData($values, 'ES_id', DBJson::mysql_real_escape_string($this->id)); } if ($this->courseId !== null) { $this->addInsertData($values, 'C_id', DBJson::mysql_real_escape_string($this->courseId)); } if ($this->endDate !== null) { $this->addInsertData($values, 'ES_endDate', DBJson::mysql_real_escape_string($this->endDate)); } if ($this->startDate !== null) { $this->addInsertData($values, 'ES_startDate', DBJson::mysql_real_escape_string($this->startDate)); } if ($this->groupSize !== null) { $this->addInsertData($values, 'ES_groupSize', DBJson::mysql_real_escape_string($this->groupSize)); } if ($this->sheetName !== null) { $this->addInsertData($values, 'ES_name', DBJson::mysql_real_escape_string($this->sheetName)); } $sFId = null; if ($this->sheetFile !== array() && $this->sheetFile !== null && $this->sheetFile->getFileId() !== null) { $sFId = $this->sheetFile->getFileId(); } $this->addInsertData($values, 'F_id_file', DBJson::mysql_real_escape_string($sFId)); $sSFId = null; if ($this->sampleSolution !== array() && $this->sampleSolution !== null && $this->sampleSolution->getFileId() !== null) { $sSFId = $this->sampleSolution->getFileId(); } $this->addInsertData($values, 'F_id_sampleSolution', DBJson::mysql_real_escape_string($sSFId)); if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->formId != null) { $this->addInsertData($values, 'FO_id', DBJson::mysql_real_escape_string(Form::getIdFromFormId($this->formId))); } if ($this->exerciseId != null) { $this->addInsertData($values, 'E_id', DBJson::mysql_real_escape_string($this->exerciseId)); } if ($this->type != null) { $this->addInsertData($values, 'FO_type', DBJson::mysql_real_escape_string($this->type)); } if ($this->solution != null) { $this->addInsertData($values, 'FO_solution', DBJson::mysql_real_escape_string($this->solution)); } if ($this->task != null) { $this->addInsertData($values, 'FO_task', DBJson::mysql_real_escape_string($this->task)); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
/** * converts a course status to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getCourseStatusInsertData($doubleEscaped = false) { $values = ''; if ($this->id != null) { $this->addInsertData($values, 'U_id', $this->id); } if ($this->courses != null && $this->courses != array()) { $this->addInsertData($values, 'CS_status', $this->courses[0]->getStatus()); } if ($this->courses != null && $this->courses != array() && $this->courses[0]->getCourse() != null) { $this->addInsertData($values, 'C_id', $this->courses[0]->getCourse()->getId()); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->id != null) { $this->addInsertData($values, 'ET_id', DBJson::mysql_real_escape_string($this->id)); } if ($this->name != null) { $this->addInsertData($values, 'ET_name', DBJson::mysql_real_escape_string($this->name)); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
public function postQuery($callName, $input, $par = array()) { $par = DBJson::mysql_real_escape_string($par); $params = array(); extract($par, EXTR_OVERWRITE); $config = parse_ini_file(dirname(__FILE__) . '/config.ini', TRUE); $obj = $input; $answer = DBRequest::request2($obj->getRequest(), $obj->getCheckSession(), $config); $result = Model::isOK(); $result['content'] = array(); $res = array(); foreach ($answer as $query_result) { $obj = new Query(); if ($query_result['errno'] != 0) { if (isset($query_result['errno']) && $query_result['errno'] != 0) { Logger::Log('GET queryResult failed errno: ' . $query_result['errno'] . ' error: ' . $query_result['error'], LogLevel::ERROR); } if (!isset($query_result['content']) || !$query_result['content']) { Logger::Log('GET queryResult failed, no content', LogLevel::ERROR); } if (isset($query_result['errno']) && $query_result['errno'] == 401) { $result = Model::isRejected(); } else { $result = Model::isProblem(); } } elseif (gettype($query_result['content']) == 'boolean') { $obj->setResponse(array()); if (isset($query_result['affectedRows'])) { $obj->setAffectedRows($query_result['affectedRows']); } if (isset($query_result['insertId'])) { $obj->setInsertId($query_result['insertId']); } if (isset($query_result['errno'])) { $obj->setErrno($query_result['errno']); } if (isset($query_result['numRows'])) { $obj->setNumRows($query_result['numRows']); } if (isset($query_result['errno']) && $query_result['errno'] > 0) { $result = Model::isProblem(); } else { $result = Model::isCreated(); } } else { $data = array(); if (isset($query_result['numRows']) && $query_result['numRows'] > 0) { $data = $query_result['content']; } $obj->setResponse($data); if (isset($query_result['affectedRows'])) { $obj->setAffectedRows($query_result['affectedRows']); } if (isset($query_result['insertId'])) { $obj->setInsertId($query_result['insertId']); } if (isset($query_result['errno'])) { $obj->setErrno($query_result['errno']); } if (isset($query_result['numRows'])) { $obj->setNumRows($query_result['numRows']); } if (isset($query_result['errno']) && $query_result['errno'] > 0) { $result = Model::isProblem(); } else { $result = Model::isCreated(); } //$result = Model::isOK(); } $res[] = $obj; } if (count($res) == 1) { $res = $res[0]; } $result['content'] = $res; return $result; }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->id != null) { $this->addInsertData($values, 'CL_id', DBJson::mysql_real_escape_string($this->id)); } if ($this->name != null) { $this->addInsertData($values, 'CL_name', DBJson::mysql_real_escape_string($this->name)); } if ($this->owner != null) { $this->addInsertData($values, 'CO_id_owner', DBJson::mysql_real_escape_string($this->owner)); } if ($this->target != null) { $this->addInsertData($values, 'CO_id_target', DBJson::mysql_real_escape_string($this->target)); } if ($this->relevanz != null) { $this->addInsertData($values, 'CL_relevanz', DBJson::mysql_real_escape_string($this->relevanz)); } if ($this->priority != null) { $this->addInsertData($values, 'CL_priority', DBJson::mysql_real_escape_string($this->priority)); } if ($this->path != null) { $this->addInsertData($values, 'CL_path', DBJson::mysql_real_escape_string($this->path)); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->user != null) { $this->addInsertData($values, 'U_id', DBJson::mysql_real_escape_string($this->user)); } if ($this->session != null) { $this->addInsertData($values, 'SE_sessionID', DBJson::mysql_real_escape_string($this->session)); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->id != null) { $this->addInsertData($values, 'A_id', DBJson::mysql_real_escape_string($this->id)); } if ($this->exerciseId != null) { $this->addInsertData($values, 'E_id', DBJson::mysql_real_escape_string($this->exerciseId)); } if ($this->file != null && $this->file->getFileId() != null) { $this->addInsertData($values, 'F_id', DBJson::mysql_real_escape_string($this->file->getFileId())); } if ($this->processId != null) { $this->addInsertData($values, 'PRO_id', DBJson::mysql_real_escape_string(Process::getIdFromProcessId($this->processId))); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->id !== null) { $this->addInsertData($values, 'AC_id', DBJson::mysql_real_escape_string($this->id)); } if ($this->courseId !== null) { $this->addInsertData($values, 'C_id', DBJson::mysql_real_escape_string($this->courseId)); } if ($this->exerciseTypeId !== null) { $this->addInsertData($values, 'ET_id', DBJson::mysql_real_escape_string($this->exerciseTypeId)); } if ($this->percentage !== null) { $this->addInsertData($values, 'AC_percentage', DBJson::mysql_real_escape_string($this->percentage)); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->id !== null) { $this->addInsertData($values, 'C_id', DBJson::mysql_real_escape_string($this->id)); } if ($this->name !== null) { $this->addInsertData($values, 'C_name', DBJson::mysql_real_escape_string($this->name)); } if ($this->semester !== null) { $this->addInsertData($values, 'C_semester', DBJson::mysql_real_escape_string($this->semester)); } if ($this->defaultGroupSize !== null) { $this->addInsertData($values, 'C_defaultGroupSize', DBJson::mysql_real_escape_string($this->defaultGroupSize)); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }
public function getSamplesInfo($callName, $input, $params = array()) { $positive = function ($input) { $result = Model::isEmpty(); $result['content'] = array(); foreach ($input as $inp) { if ($inp->getNumRows() > 0) { foreach ($inp->getResponse() as $key => $value) { foreach ($value as $key2 => $value2) { $result['content'][] = $value2; } } $result['status'] = 200; } } return $result; }; $params = DBJson::mysql_real_escape_string($params); return $this->_component->call($callName, $params, '', 200, $positive, array(), 'Model::isProblem', array(), 'Query'); }
/** * converts an object to insert/update data * * @return a comma separated string e.g. "a=1,b=2" */ public function getInsertData($doubleEscaped = false) { $values = ''; if ($this->processId != null) { $this->addInsertData($values, 'PRO_id', DBJson::mysql_real_escape_string(Process::getIdFromProcessId($this->processId))); } if ($this->exercise !== null && $this->exercise->getId() !== null) { $this->addInsertData($values, 'E_id', DBJson::mysql_real_escape_string($this->exercise->getId())); } if ($this->target != null) { $this->addInsertData($values, 'CO_id_target', DBJson::mysql_real_escape_string($this->target->getId())); } if ($this->parameter != null) { $this->addInsertData($values, 'PRO_parameter', DBJson::mysql_real_escape_string($this->parameter)); } if ($values != '') { $values = substr($values, 1); } return $doubleEscaped ? DBJson::mysql_real_escape_string($values) : $values; }