. */ /** * List Show Class * * Contains all the function to manage and show list * * @package Maarch * @version 2.1 * @since 10/2005 * @license GPL * @author Claire Figueras * @author Loïc Vinet * @author Laurent Giovannoni * */ class list_show_Abstract extends functions { /** * Show the document list in result of the search * * @param array $listarr * @param integer $nb_total total number of documents * @param string $title * @param string $what search expression * @param string $name "search" by default, the calling page * @param string $key the key seach for the form * @param string $detail_destination the link to detail page * @param boolean $bool_view_document boolean to view document or not * @param boolean $bool_radio_form boolean to add radio to select row * @param string $method method of the select form * @param string $action action of the select form * @param string $button_label label(session var) of the button of the select form * @param boolean $bool_detail boolean to show the detail page link or not * @param boolean $bool_order boolean to show the order icons or not * @param boolean $bool_frame true if calling by frame * @param boolean $bool_export true if we activate the list export (obsolete => to delete) * @param boolean $show_close true : the close window button is showed * @param boolean $show_big_title true : the title is displayed in the title container * @param boolean $show_full_list true : the list takes all the screen, otherwise it is addforms2 class * @param boolean $bool_check_form true : add checkbox to select row * @param string $res_link obsolete (to delete) * @param string $module module name if the function is called in a module * @param boolean $bool_show_listletters true : show list letters, search on the elements of the list possible * @param string $all_sentence string : all item * @param string $whatname name of the element to search * @param string $used_css css used in the list * @param string $comp_link url link complement * @param string $link_in_line * @param string $bool_show_actions_list true : shows the possible actions of the list on a combo list * @param array $actions list of the elements of the actions combo list * @param string $hidden_fields hidden fields in the form */ public function list_doc( $result, $nb_total, $title, $what, $name = "search", $key, $detail_destination, $bool_view_document, $bool_radio_form, $method, $action, $button_label, $bool_detail, $bool_order, $bool_frame= false, $bool_export= false, $show_close = FALSE, $show_big_title = true, $show_full_list = true, $bool_check_form = false, $res_link = '', $module='', $bool_show_listletters = false, $all_sentence = '', $whatname = '', $used_css = 'listing spec', $comp_link = "", $link_in_line = false, $bool_show_actions_list = false, $actions = array(), $hidden_fields = '', $actions_json= '{}', $do_action = false, $id_action = '', $open_details_popup = true, $do_actions_arr = array(), $template = false, $template_list = array(), $actual_template= '', $mode_string = false, $hide_standard_list = false ) { //echo $actual_template;exit; if ($template && $actual_template <> '') { $str = ''; $str .= '
'; require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR.'class_list_show_with_template.php'); $list_temp = new list_show_with_template(); $str .= $list_temp->list_doc_by_template($result, $nb_total, $title,$what,$name,$key,$detail_destination,$bool_view_document,$bool_radio_form,$method,$action, $button_label, $bool_detail, $bool_order, $bool_frame,$bool_export, $show_close, $show_big_title, $show_full_list, $bool_check_form, $res_link, $module, $bool_show_listletters, $all_sentence, $whatname, $used_css , $comp_link, $link_in_line, $bool_show_actions_list , $actions, $hidden_fields, $actions_json, $do_action, $id_action , $open_details_popup, $do_actions_arr, $template, $template_list, $actual_template, true, $hide_standard_list); $str .= '
'; if($mode_string) { return $str; } else { echo $str; } } else { $str = ''; if ($bool_export) { $str .= '
'; } require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR.'class_list_show_with_template.php'); //show the document list in result of the search $page_list1 = ""; $page_list2 = ""; $link=""; $str .= ''; //$listvalue = array(); $listcolumn = array(); $listshow = array(); $listformat = array(); $ordercol = array(); if(isset($_REQUEST['start']) && $_REQUEST['start'] > $nb_total) { $_REQUEST['start'] = 0; } // put in tab the different label of the column for ($j=0;$j '' { $link .= "&order=".$orderby; } if(isset($_REQUEST['order_field'])) { $orderfield = strip_tags($_REQUEST['order_field']); } else { $orderfield = ''; } if(!preg_match('/order_field=/', $comp_link) && $orderfield <> '') { $link .= "&order_field=".$orderfield; } $link .= $comp_link; $nb_show = $_SESSION['config']['nblinetoshow']; $nb_pages = ceil($nb_total/$nb_show); $end = $start + $nb_show; if($end > $nb_total) { $end = $nb_total; } if($actual_template <> '') { $link .= "&template=".$actual_template; } else { $link .= "&template="; } //######################## $disp_dc = ''; $core = new core_tools(); if($core ->is_module_loaded("doc_converter") && $bool_export) { $_SESSION['doc_convert'] = array(); require_once("modules".DIRECTORY_SEPARATOR."doc_converter".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php"); $doc_converter = new doc_converter(); $disp_dc = $doc_converter->convert_list($result, true); } //######################## $tdeto = ''; if ($template == true) { require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR.'class_list_show_with_template.php'); $template_object = new list_show_with_template(); $tdeto = $template_object->display_template_for_user($template_list, $link); } // if they are more 1 page we do pagination with 2 forms $previous = ""; $next = ""; if($nb_pages > 1) { $next_start = 0; //$search_form = "
"; $page_list1 = _GO_TO_PAGE." "; $lastpage = $lastpage - $nb_show; if($start > 0) { $start_prev = $start - $nb_show; $previous = "     "; } if($start <> $lastpage) { $start_next = $start + $nb_show; $next = " "; } } $page_list1 = '
'.$previous.''.$next.'|'.$page_list1.'|'.$disp_dc.'|'.$tdeto.'
'; if($show_big_title) { $str .= '

'; if(!empty($picto_path)) { $str .= ' ';} $str .= $title.'

'; } else { $str .= ''; if(!empty($picto_path)) { $str .= ' ';} $str .= $title.''; } if($bool_show_listletters) { $str.=self::listletters($link,$name,$all_sentence,_SEARCH." ".$whatname,_ALPHABETICAL_LIST, false, false, array(), true); } $str .= $page_list1; $str .= '
'; if($bool_radio_form || $bool_check_form || ($do_action && !empty($id_action))) { $temp = '"; } else { $temp .= "\" >"; } $str .= $temp; $str .= $hidden_fields; } if( (($bool_radio_form || $bool_check_form) && count($result) > 0 && $bool_show_actions_list) || ($do_action && !empty($id_action))) { $str .= ''; } $str .= ' '; $str .= ' '; $str .= ' '; if($bool_view_document) { $str .= ' '; } if($bool_radio_form ||$bool_check_form) { $str .= ' '; } for($count_column = 0;$count_column < count($listcolumn);$count_column++) { if($listshow[$count_column]==true) { $str .= ' '; } } if($bool_detail) { $str .= ' '; } $str .= ''; $str .= ' '; $str .= ' '; $color = ""; for($theline = $start; $theline < $end ; $theline++) { if($color == ' class="col"') { $color = ''; } else { $color = ' class="col"'; } $str .= ' '; if ($bool_radio_form || $bool_check_form) { $str .= ' '; } if ($bool_view_document) { $str .= ' '; } for($count_column = 0;$count_column < count($listcolumn);$count_column++) { if(isset($result[$theline][$count_column]['show']) && $result[$theline][$count_column]['show'] == true ) { if($do_action && !empty($id_action) && (count($do_actions_arr) == 0 || $do_actions_arr[$theline] == true) ) { $str .= ' '; } else if($link_in_line) { $str .= ' '; $str .= ' '; } else { $str .= ' '; } elseif($bool_frame && !$open_details_popup) { $str .= ''; } else { $str .= ' '; } } $str .= ' '; } $str .= ''; $str .= '
  '.$listcolumn[$count_column]; if($bool_order) { $str .= '

'; } $str .= '
 
'; $str .= '
'; if ($bool_radio_form) { if (count($do_actions_arr) == 0 || $do_actions_arr[$theline] == true ) { $str .= '  '; } else { $str .= ''; } } else if ($bool_check_form) { if (! $bool_show_actions_list ) { $str .= '  '; } else { if (count($do_actions_arr) == 0 || $do_actions_arr[$theline] == true ) { $str .= '  '; } else { $str .= ''; } } } $str .= '
'; $str .= '
'; $str .= '
'; if ($bool_view_document) { $str .= ''; $str .= ' '; } $str .= '
'; $str .= '
'; } else if($do_action && !empty($id_action) && $do_actions_arr[$theline] == false) { $str .= ' '.functions::show_str(self::thisword($result[$theline][$count_column]['value'],$what)).''.functions::show_str(self::thisword($result[$theline][$count_column]['value'],$what)).''; } } } if($bool_detail) { if($bool_frame && $open_details_popup) { $str .= '
'; $str .= '
'; $str .= '
'; $str .= ''; $str .= '
'; $str .= '
'; $str .= '
'; if(($bool_radio_form || $bool_check_form) && count($result) > 0 && !$bool_show_actions_list) { $str .= '

'; $str .= ' '; if($show_close ) { $str .= ' '; } $str .= '

'; $str .= ' '; $str .= '
'; } else if(($bool_radio_form || $bool_check_form) && count($result) > 0 && $bool_show_actions_list) { $str .= '

'; $str .= ' '._ACTIONS.' :'; $str .= ' '; $str .= ' '; $str .= '

'; $str .= ' '; $str .= '
'; } elseif($do_action) { $str .= ' '; } elseif($show_close) { $str .= ' '; } if ($bool_export) { $str .= '
'; } if($mode_string) { return $str; } else { echo $str; } } } /** * Mark with a color background the word you're searching in the detail of the row * * @param string $words * @param string $need * @return string $words * @return string $size */ protected static function thisword($words,$need, $is_split = FALSE, $size = 70) { // mark with a color background the word you're searching in the detail of the row if(!$is_split || strlen($words) < $size) { if (strlen($need) > 3) { $ar_need = explode(" ", $need); for($i = 0; $i < count($ar_need); $i++) { $save_ar_need = ""; $pos = stripos($words, $ar_need[$i]); if($pos !== false) { $save_ar_need = substr($words, $pos, strlen($ar_need[$i])); } $words = preg_replace("/(".$ar_need[$i].")/i","".$save_ar_need."",$words); } } } else { $i = 0; $newwords = ''; if(preg_match('/@/', $words)) { $tab_words = preg_split('/@/', $words); $newwords = $tab_words[0].'@
'.$tab_words[1]; } else if(!preg_match('/ /', $words)) { while(true) { if(strlen(substr($words, $i)) > $size) { $newwords .= '
'.substr($words,$i, $size); $i = $i + $size ; } else { $newwords .= '
'.substr($words,$i); break; } } } else { $newwords = $words; } /*while(true) { if(strlen(substr($words, $i)) > $size) { $newwords .= '
'.substr($words,$i, $size); $i = $i + $size ; } else { $newwords .= '
'.substr($words,$i); break; } }*/ $words =$newwords; //$words = $words. '
[...]'; } return $words; } /* * * show the alphabetical list * * @param string $page the page (users, groups,...) * @param string $all_text txt to say all item * @param string $button_text text of button * @param string $alpha_text text of the alphabetical list */ public static function listletters($link, $page, $all_text, $button_text, $alpha_list_text, $show_searchbox = true, $autoCompletion = false, $autoCompletionArray2 = array(), $whatinput = 'what', $whatListinput = 'whatList') { $link = preg_replace("/(&(?!amp;))/", "&", $link); ?>
: -
$nb_total) { $end = $nb_total; } if(!empty($what)) { $link .= "&what=".$what; } $link = preg_replace("/(&(?!amp;))/", "&", $link); // if they are more 1 page we do pagination with 2 forms if($nb_pages > 1) { $next_start = 0; $page_list1 = '

"; if($start > 0) { $start_prev = $start - $nb_show; $previous = "    "; } if($start <> $lastpage) { $start_next = $start + $nb_show; $next = " "; } $page_list1 .= $previous." ".$next.'

'; } if($show_big_title) { echo '

'; if(!empty($picto_path)) { echo ' ';} echo $title.'

'; ?>
'; if(!empty($picto_path)) { echo ' ';} echo $title.''; echo '
'; } if(!$bool_history) { if($show_listletters) { if(!$autoCompletion) { self::listletters($link, $name, $all_sentence, _SEARCH." ".$whatname, _ALPHABETICAL_LIST); } else { self::listletters($link, $name, $all_sentence, _SEARCH." ".$whatname, _ALPHABETICAL_LIST, true, $autoCompletion, $autoCompletionArray, $whatinput, $whatListinput); } } } echo $page_list1; ?> > 'types') {?>
style="width:%;" valign="" align="" > 
?'));"> query("select item_id, item_mode, entity_id, entity_label from listmodels, entities where item_id = ? and item_mode = 'dest' and listmodels.object_id = entities.entity_id",array($result[$theline][0][$key])); $entity_label = array(); while($res = $stmt->fetchObject()){ $item_mode = null; $item_mode = $res->item_mode; $entity_label[] = $res->entity_label; } if($item_mode == 'dest'){ ?> ?'));"> ?'));"> ?\n\r\n\r'));"> ?\n\r\n\r'));">

is_module_loaded("doc_converter")) { $_SESSION['doc_convert'] = array(); require_once("modules".DIRECTORY_SEPARATOR."doc_converter".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php"); $doc_converter = new doc_converter(); $doc_converter->convert_list($result); } ?> '; if (!empty($picto_path)) { $str .= ' '; } $str .= $title . ''; $str .= '
'; $str .= ''; $str .= ''; $str .= ''; if ($bool_view_document) { $str .= ''; } for ($count_column = 0;$count_column < count($listcolumn);$count_column++) { if ($listshow[$count_column]==true) { $str .= ''; $str .= ''; $str .= ''; $str .= ''; $color = ""; for ($theline = $start; $theline < $end ; $theline++) { if($color == ' class="col"') { $color = ''; } else { $color = ' class="col"'; } $str .= ''; if ($bool_view_document) { $str .= " "; } $bool_modify = false; $bool_del = false; for ($count_column=0;$count_column' . functions::show_str(self::thisword($result[$theline][$count_column]['value'], $what)) . ''; } else { if ($result[$theline][$count_column]['column'] == 'modify_item' && $result[$theline][$count_column]['value'] == true) { $bool_modify = true; } if ($result[$theline][$count_column]['column'] == 'delete_item' && $result[$theline][$count_column]['value'] == true) { $bool_del = true; } } } if ($bool_modify) { $str .= ''; } else { $str .= ''; } if ($bool_del) { $str .= ''; } else { $str .= ''; } $str .= ''; } $str .= ''; $str .= '
 ' . $listcolumn[$count_column] . ''; } } $str .= ' 
" . '' . "'; $str .= '' . ''; $str .= ' '; $str .= '' . _DELETE . ''; $str .= ' 
'; $str .= '
'; if ($modeString) { return $str; } else { echo $str; } } public function list_attachments( $result, $nb_total, $title, $what, $key, $bool_view_document, $page_view = '', $used_css = 'listing spec', $page_modify = '', $height_page_modify = 400, $width_page_modify = 500, $page_del = '', $modeString = false ) { //self::show_array($result); $listcolumn = array(); $listshow = array(); $listformat = array(); $start = 0; $end = $nb_total; $str = ''; // put in tab the different label of the column if (isset($result[0])) { for ($j = 0; $j < count($result[0]); $j ++) { if (isset($result[0][$j]["label"])) { array_push($listcolumn, $result[0][$j]["label"]); } else { array_push($listcolumn, ''); } if (isset($result[0][$j]["show"])) { array_push($listshow, $result[0][$j]["show"]); } else { array_push($listshow, false); } } } //self::show_array($listcolumn); //self::show_array($listshow); $func = new functions(); $nb_show = $_SESSION['config']['nblinetoshow']; $str .= ''; if (!empty($picto_path)) { $str .= ' '; } $str .= $title . ''; $str .= '
'; $str .= ''; $str .= ''; $str .= ''; $str .= ''; if ($bool_view_document) { $str .= ''; } for ($count_column = 0;$count_column < count($listcolumn);$count_column++) { if ($listshow[$count_column]==true) { $str .= ''; $str .= ''; $str .= ''; $str .= ''; $color = ""; for ($theline = $start; $theline < $end ; $theline++) { if($color == ' class="col"') { $color = ''; } else { $color = ' class="col"'; } $str .= ''; if ($bool_view_document) { $str .= " "; } $bool_modify = false; $bool_del = false; for ($count_column=0;$count_column' . functions::show_str(self::thisword($result[$theline][$count_column]['value'], $what)) . ''; } else { if ($result[$theline][$count_column]['column'] == 'modify_item' && $result[$theline][$count_column]['value'] == true) { $bool_modify = true; } if ($result[$theline][$count_column]['column'] == 'delete_item' && $result[$theline][$count_column]['value'] == true) { $bool_del = true; } } } if ($bool_modify) { $str .= ''; } else { $str .= ''; } if ($bool_del) { $str .= ''; } else { $str .= ''; } $str .= ''; } $str .= ''; $str .= '
 ' . $listcolumn[$count_column] . ''; } } $str .= ' 
" . '' . "'; $str .= '' . _MODIFY . ''; $str .= ' '; $str .= '' . _DELETE . ''; $str .= ' 
'; $str .= '
'; if ($modeString) { return $str; } else { echo $str; } } }