. */ /** * @brief Postindexing reservation page * @file * @author Yves Christian KPAKPO * @date $date$ * @version $Revision$ * @ingroup indexing_searching */ 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"); $core_tools = new core_tools(); $core_tools->load_lang(); $security = new security(); $func = new functions(); $postindexing = new postindexing(); //Clean Up !! unset($_SESSION['postindexing']['resid_pointeur']); unset($_SESSION['postindexing']['work']); unset($_SESSION['postindexing']['res_actif']); //Get the table if(!empty($_SESSION['current_basket']['view'])) { $table = $_SESSION['current_basket']['view']; } else { $table = $_SESSION['current_basket']['table']; } //Initialize time values $timestamp = time(); $max_video_time = $timestamp + ($_SESSION['postindexing']['max_time'] * 60); //If the user still got ressources to postindex $select[$table]= array(); array_push($select[$table],"res_id"); $where_already_reserved = " ( (video_batch is not null and video_user = '".$_SESSION['user']['UserId']."' and video_time > ".$timestamp.") ) and ".$_SESSION['current_basket']['clause']; //$groupby = "group by doc_custom_t1"; $request= new request; $tab1 = array(); $tab1 = $request->select($select, $where_already_reserved, $groupby, $_SESSION['config']['databasetype']); //$request->show(); // echo "NB_DOCS: ". $_SESSION['postindexing']['nb_docs']."
";//DEBUG // echo "COUNT: ".count($tab1)."
";//DEBUG // echo "MAX_FILES: ".$_SESSION['postindexing']['max_files']."
";//DEBUG if ((count($tab1) < $_SESSION['postindexing']['max_files']) && (count($tab1) < $_SESSION['postindexing']['nb_docs']) ) { //Number of ressources to add to complète the max batch files $max_files = $_SESSION['postindexing']['max_files'] - count($tab1) ; //echo "RESERVATION
"; //echo "COUNT MAX: ".$max_files."
";//DEBUG //new workbatch $workbatch = $postindexing->get_workbatch(); $_SESSION['postindexing']['workbatch'] = $workbatch; $_SESSION['data'] = array(); array_push($_SESSION['data'], array('column' => "video_batch", 'value' => $workbatch, 'type' => "int")); array_push($_SESSION['data'], array('column' => "video_user", 'value' => $_SESSION['user']['UserId'], 'type' => "string")); array_push($_SESSION['data'], array('column' => "video_time", 'value' => $max_video_time, 'type' => "string")); $where = " ( (video_batch is null) or (video_batch is not null and video_user = '".$_SESSION['user']['UserId']."' and video_time < ".$timestamp.") or ( (video_batch is not null and video_user <> '".$_SESSION['user']['UserId']."') and (video_batch is not null and video_time < ".$timestamp.") ) ) and ".$_SESSION['current_basket']['clause']; $request->update($_SESSION['current_basket']['table'], $_SESSION['data'], $where, $_SESSION['config']['databasetype'], $max_files); //$request->show(); //exit; } //Documents à videocoder $_SESSION['postindexing']['docs'] = array(); $_SESSION['postindexing']['docs'] = $postindexing->get_user_reserved_doc($_SESSION['current_basket']['table']); //Nombre de documents à videocoder $_SESSION['postindexing']['nb_total'] = count($_SESSION['postindexing']['docs']); //On initialise le compteur de document validé $_SESSION['postindexing']['work'] = 0 ; //$func->show_array($tab_res); //echo "NBR RESERVED: ".$_SESSION['postindexing']['nb_total']."
";//DEBUG ?>