コード例 #1
0
ファイル: raf.class.php プロジェクト: vinod-co/centa
 /**
  * IMPORT: Take the textual keywords of a question, lookup IDs and then insert into the DB.
  * @param array $keywords	- Array of textual keywords
  * @param int $q_id			 	- ID of the question the keywords are for.
  */
 private function write_keywords($keywords, $q_id)
 {
     if ($this->raf_company == $this->configObj->get('cfg_company')) {
         // The import file company is the same as the current installation. Use the same IDs.
         $keywordIDs = $keywords;
     } else {
         $keywordIDs = array();
         foreach ($keywords as $keyword) {
             if (isset($this->keywords_lookup[$keyword])) {
                 $tmp_ID = $this->keywords_lookup[$keyword];
                 $keywordIDs[$tmp_ID] = $tmp_ID;
             }
         }
     }
     if (count($keywordIDs) > 0) {
         QuestionUtils::add_keywords($keywordIDs, $q_id, $this->db);
     }
 }
コード例 #2
0
ファイル: copy_onto_paper.php プロジェクト: vinod-co/centa
 if ($save_ok === false) {
     // NO - rollback
     $mysqli->rollback();
 } else {
     // YES - commit the updates to the tables
     $mysqli->commit();
 }
 // Turn auto commit back on so future queries function as before
 $mysqli->autocommit(true);
 if ($save_ok) {
     // Create a track changes record to say where question came from.
     $question_id = intval($question_id);
     $success = $logger->track_change('Copied Question', $question_id, $userObject->get_user_ID(), $q_IDs[$i], $question_id, 'Copied Question');
     // Lookup and copy the keywords
     $keywords = QuestionUtils::get_keywords($q_IDs[$i], $mysqli);
     QuestionUtils::add_keywords($keywords, $question_id, $mysqli);
     // Lookup modules
     $modules = QuestionUtils::get_modules($q_IDs[$i], $mysqli);
     QuestionUtils::add_modules($modules, $question_id, $mysqli);
     if ($map_outcomes) {
         // Make sure that paper is on the module we're copying from
         $paper_modules = $properties->get_modules();
         if (in_array($_GET['module'], array_keys($paper_modules))) {
             if (isset($_POST['outcomes']) and $_POST['outcomes'] != '') {
                 $outcomes = json_decode($_POST['outcomes'], true);
                 $mappings = $mysqli->prepare("SELECT question_id, obj_id FROM relationships WHERE question_id = ? AND idMod = ?");
                 echo $mysqli->error;
                 $mappings->bind_param('ii', $q_IDs[$i], $_GET['module']);
                 $mappings->execute();
                 $mappings->store_result();
                 $mappings->bind_result($map_q_id, $obj_id);