public function store(CAppUI $AppUI = null) { global $AppUI; $q = new w2p_Database_Query(); $q->addTable('project_designer_options'); $q->addReplace('pd_option_user', $this->pd_option_user); $q->addReplace('pd_option_view_project', $this->pd_option_view_project); $q->addReplace('pd_option_view_gantt', $this->pd_option_view_gantt); $q->addReplace('pd_option_view_tasks', $this->pd_option_view_tasks); $q->addReplace('pd_option_view_actions', $this->pd_option_view_actions); $q->addReplace('pd_option_view_addtasks', $this->pd_option_view_addtasks); $q->addReplace('pd_option_view_files', $this->pd_option_view_files); $q->addWhere('pd_option_user = ' . (int) $this->pd_option_user); $q->exec(); return true; }
public function updateUserSpecificTaskPriority($user_task_priority = 0, $user_id = 0, $task_id = null) { $q = new w2p_Database_Query(); // use task_id of given object if the optional parameter task_id is empty $task_id = empty($task_id) ? $this->task_id : $task_id; $q->addTable('user_tasks'); $q->addReplace('user_id', $user_id); $q->addReplace('task_id', $task_id); $q->addReplace('user_task_priority', $user_task_priority); $q->exec(); $q->clear(); }
if ($upd_task->task_id) { //If parent is self task //print_r($bulk_task_dependency);die; if ($bulk_task_dependency == '0') { $upd_task->task_dynamic = 0; $upd_task->store($AppUI); $q = new w2p_Database_Query(); $q->setDelete('task_dependencies'); $q->addWhere('dependencies_task_id=' . $upd_task->task_id); $q->exec(); } elseif (!($bulk_task_dependency == $upd_task->task_id)) { $upd_task->task_dynamic = 31; $upd_task->store($AppUI); $q = new w2p_Database_Query(); $q->addTable('task_dependencies'); $q->addReplace('dependencies_task_id', $upd_task->task_id); $q->addReplace('dependencies_req_task_id', $bulk_task_dependency); $q->exec(); //Lets recalc the dependency $dep_task = new CTask(); $dep_task->load($bulk_task_dependency); if ($dep_task->task_id) { $dep_task->shiftDependentTasks(); } } } } //Action: Modify priority if (isset($_POST['bulk_task_priority']) && $bulk_task_priority != '') { if ($upd_task->task_id) { $upd_task->task_priority = $bulk_task_priority;
public function indexStrings() { global $w2Pconfig; $nwords_indexed = 0; /* Workaround for indexing large files: ** Based on the value defined in config data, ** files with file_size greater than specified limit ** are not indexed for searching. ** Negative value :<=> no filesize limit */ $index_max_file_size = w2PgetConfig('index_max_file_size', 0); if ($this->file_size > 0 && ($index_max_file_size < 0 || (int) $this->file_size <= $index_max_file_size * 1024)) { // get the parser application $parser = $w2Pconfig['parser_' . $this->file_type]; if (!$parser) { $parser = $w2Pconfig['parser_default']; } if (!$parser) { return false; } // buffer the file $this->_filepath = W2P_BASE_DIR . '/files/' . $this->file_project . '/' . $this->file_real_filename; if (file_exists($this->_filepath)) { $fp = fopen($this->_filepath, 'rb'); $x = fread($fp, $this->file_size); fclose($fp); // parse it $parser = $parser . ' ' . $this->_filepath; $pos = strpos($parser, '/pdf'); /* * TODO: I *really* hate using error surpression here and I would * normally just detect if safe_mode is on and if it was, skip * this call. Unfortunately, safe_mode has been deprecated in * 5.3 and will be removed in 5.4 */ if (false !== $pos) { $x = @shell_exec(`{$parser} -`); } else { $x = @shell_exec(`{$parser}`); } // if nothing, return if (strlen($x) < 1) { return 0; } // remove punctuation and parse the strings $x = str_replace(array('.', ',', '!', '@', '(', ')'), ' ', $x); $warr = explode(' ', $x); $wordarr = array(); $nwords = count($warr); for ($x = 0; $x < $nwords; $x++) { $newword = $warr[$x]; if (!preg_match('[!"#$%&\'()*+,\\-./:;<=>?@[\\\\]^_`{|}~]', $newword) && mb_strlen(mb_trim($newword)) > 2 && !preg_match('[0-9]', $newword)) { $wordarr[$newword] = $x; } } // filter out common strings $ignore = w2PgetSysVal('FileIndexIgnoreWords'); $ignore = str_replace(' ,', ',', $ignore); $ignore = str_replace(', ', ',', $ignore); $ignore = explode(',', $ignore); foreach ($ignore as $w) { unset($wordarr[$w]); } $nwords_indexed = count($wordarr); // insert the strings into the table while (list($key, $val) = each($wordarr)) { $q = new w2p_Database_Query(); $q->addTable('files_index'); $q->addReplace('file_id', $this->file_id); $q->addReplace('word', $key); $q->addReplace('word_placement', $val); $q->exec(); $q->clear(); } } else { //TODO: if the file doesn't exist.. should we delete the db record? } } $q = new w2p_Database_Query(); $q->addTable('files'); $q->addUpdate('file_indexed', 1); $q->addWhere('file_id = ' . $this->file_id); $q->exec(); return $nwords_indexed; }