. */ /** * @brief Action : Document postindexing * * Open a modal box to displays the postindexing form. Used by the core (manage_action.php page). * * @file * @author Yves Christian Kpakpo * @date $date$ * @version $Revision$ * @ingroup apps */ /** * $confirm bool false */ $confirm = false; /** * $etapes array Contains only one etap : form */ $etapes = array('form'); /** * $frm_width Width of the modal (empty) */ $frm_width=''; /** * $frm_height Height of the modal (empty) */ $frm_height = ''; /** * $mode_form Mode of the modal : fullscreen */ $mode_form = 'fullscreen'; function reserve_docs($folder_system_id, $folder_coll_id) { require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"); require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_security.php"); require_once("modules".DIRECTORY_SEPARATOR."postindexing".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php"); $func = new functions(); $db = new dbquery(); $postindexing = new postindexing(); $request= new request; $sec = new security(); //DEBUG!!!!!! $debug = false; $debug_msg = ''; //Clean Up !! $postindexing->reinit_postindexing_session(); //the ressource table $coll_id = $_SESSION['tablename']['postindexing_collection']; $table = $sec->retrieve_table_from_coll($coll_id); //Initialize time values $timestamp = time(); $max_video_time = $timestamp + ($_SESSION['postindexing']['max_time'] * 60); //Release user's expired documents $postindexing->release_user_docs($table); $select[$table]= array(); //Toutes les "Where Clause" dans un tableau $where_tab = array(); $where_tab[] = " ( (video_batch is null) or (video_batch is not null and video_user = '".$_SESSION['user']['UserId']."') or ( (video_batch is not null and video_user <> '".$_SESSION['user']['UserId']."' and video_time < ".$timestamp.") ) )"; $where_tab[] = "folders_system_id = ".$folder_system_id; $where = implode(' and ', $where_tab); //Les champs a recuperer array_push($select[$table], "res_id", "status"); $orderstr = ' order by creation_date asc'; $sqlReservation = "SELECT res_id from ".$table." WHERE ".$where." ".$orderstr; $debug_msg .= addslashes($sqlReservation); //new workbatch $workbatch = $postindexing->get_workbatch(); $_SESSION['postindexing']['workbatch'] = $workbatch; //Get down on it!! $db->connect(); $theSqlQuery = "update ".$table." set video_user = '".$_SESSION['user']['UserId']."' , video_batch = ".$workbatch." , video_time = ".$max_video_time." where res_id in (".$sqlReservation .")"; $db->query($theSqlQuery); $debug_msg .= addslashes($theSqlQuery); //On recupere les documents reservés $_SESSION['postindexing']['docs'] = array(); $_SESSION['postindexing']['docs'] = $postindexing->get_user_reserved_doc($table); //Nombre de documents à videocoder $_SESSION['postindexing']['nb_total'] = count($_SESSION['postindexing']['docs']); //Verouiller le dossier en cours de vidéocodage $db->query("update ".$_SESSION['tablename']['fold_folders']." set video_status = 'LCK', video_user = '".$_SESSION['user']['UserId']."' where folders_system_id = ".$folder_system_id); //On initialise le compteur de document validé $_SESSION['postindexing']['work'] = 0 ; //Folder id $_SESSION['postindexing']['folder_system_id'] = $folder_system_id; //Folder label $db->query("select folder_id from ".$_SESSION['tablename']['fold_folders']." where folders_system_id = ".$folder_system_id); $res = $db->fetch_object(); $_SESSION['postindexing']['folder_label'] = $res->folder_id ; //Reset of the Info box if (isset($_SESSION['postindexing']['showHideBox'])) { unset($_SESSION['postindexing']['showHideBox']); } //Debug if ($debug) { $debug_msg .= "
NB RESERVED DOCS: ".$_SESSION['postindexing']['nb_total']."
";//DEBUG //exit; return $debug_msg; } } /** * Returns the validation form text * * @param $values Array Contains the res_id of the document to validate * @param $path_manage_action String Path to the PHP file called in Ajax * @param $id_action String Action identifier * @param $table String Table * @param $module String Origin of the action * @param $coll_id String Collection identifier * @param $mode String Action mode 'mass' or 'page' * @return String The form content text **/ function get_form_txt($values, $path_manage_action, $id_action, $table, $module, $coll_id, $mode ) { $folder_id = $values[0]; $frm_str =''; //$frm_str .='folder_id: '.$folder_id; //If folder if (isset($folder_id) && !empty($folder_id)) { $frm_str .= reserve_docs($folder_id, $coll_id); } //Iframe with the page $frm_str .= ''; $frm_str .= ''; return addslashes($frm_str); } ?>