db = $db; } /** * Show filter form in agenda view * * @param Form $form Form object * @param int $canedit Can edit filter fields * @param int $status Status * @param int $year Year * @param int $month Month * @param int $day Day * @param int $showbirthday Show birthday * @param string $filtera Filter on create by user * @param string $filtert Filter on assigned to user * @param string $eventdetails Filter on eventdetails * @param string $eventproduct Filter on eventproduct * @param string $eventlocation Filter on eventlocation * @param string $filterd Filter of done by user * @param int $pid Product id * @param int $socid Third party id * @param string $action Action string * @param array $showextcals Array with list of external calendars (used to show links to select calendar), or -1 to show no legend * @param string|array $actioncode Preselected value(s) of actioncode for filter on event type * @param int $usergroupid Id of group to filter on users * @param string $excludetype A type to exclude ('systemauto', 'system', '') * @param int $resourceid Preselected value of resource for filter on resource * @return void */ function new_print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $eventdetails, $eventproduct, $eventlocation, $filterd, $pid, $socid, $action, $showextcals = array(), $actioncode = '', $usergroupid = '', $excludetype = '', $resourceid = 0) { global $conf, $user, $langs, $db, $hookmanager; global $begin_h, $end_h, $begin_d, $end_d; global $massaction; $langs->load("companies"); include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions = new FormActions($db); // Filters //print '
'; print ''; print ''; print ''; print ''; if ($massaction != 'predelete' && $massaction != 'preaffecttag') { // When $massaction == 'predelete', action may be already output to 'delete' by the mass action system. print ''; } print ''; if ($canedit) { // Assigned to user print '
'; print img_picto($langs->trans("ActionsToDoBy"), 'user', 'class="pictofixedwidth inline-block"'); print $form->select_dolusers($filtert, 'search_filtert', 1, '', !$canedit, '', '', 0, 0, 0, '', 0, '', 'minwidth150 maxwidth500 widthcentpercentminusxx'); print '
'; } if ($canedit && !preg_match('/list/', $_SERVER["PHP_SELF"])) { // Status print '
'; print img_picto($langs->trans("Status"), 'setup', 'class="pictofixedwidth inline-block"'); $formactions->form_select_status_action('formaction', $status, 1, 'search_status', 1, 2, 'minwidth100'); print '
'; } //print $form->select_dolusers($eventdetails, 'search_eventdetails', 1, '', !$canedit, '', '', 0, 0, 0, '', 0, '', 'minwidth150 maxwidth500 widthcentpercentminusxx'); // new filters (event_details, event products, event location from) print '
'; print img_picto($langs->trans("ActionsToDoBy"), 'fa-cogs', 'class="pictofixedwidth inline-block"'); print $this->eventselector($eventdetails, 'eventdetails', 1); print '
'; print '
'; print img_picto($langs->trans("ActionsToDoBy"), 'fa-product-hunt', 'class="pictofixedwidth inline-block"'); print $this->eventselector($eventproduct, 'eventproduct', 1); print '
'; print '
'; print img_picto($langs->trans("ActionsToDoBy"), 'fa-location-arrow', 'class="pictofixedwidth inline-block"'); print $this->eventselector($eventlocation, 'eventlocation', 1); print '
'; // Hooks $parameters = array('canedit' => $canedit, 'pid' => $pid, 'socid' => $socid); $object = null; $reshook = $hookmanager->executeHooks('searchAgendaFrom', $parameters, $object, $action); // Note that $action and $object may have been print '
'; } private function eventselector($selected, $htmlname, $show_empty = 0, $multiple = false, $disabled = 0) { global $db, $langs; $i = 0; $out = ''; $morecss = ''; $textforempty = ' '; $sql = "SELECT rowid, label FROM llx_eventwizard_{$htmlname} ORDER BY label ASC"; $result = $this->db->query($sql); $num = $this->db->num_rows($result); if ($selected === '') { $selected = array(); } elseif (!is_array($selected)) { $selected = array($selected); } if ($num) { $out .= ''; $out .= ''; } $out .= ''; return $out; } function getSearchedElement($element) { return GETPOST("search_" . $element, "int", 3) ? GETPOST("search_" . $element, "int", 3) : GETPOST($element, "int", 3); } function completeParametersArray($parameters, $eventdetails, $eventproduct, $eventlocation) { foreach ($this->addedFilters as $filter) { $parameters[$filter] = $$filter; } return $parameters; } function completeParamString($eventdetails, $eventproduct, $eventlocation) { $param = ''; if ($eventdetails) { $param .= "&search_eventdetails=" . urlencode($eventdetails); } if ($eventproduct) { $param .= "&search_eventproduct=" . urlencode($eventproduct); } if ($eventlocation) { $param .= "&search_eventlocation=" . urlencode($eventlocation); } return $param; } function completeSqlSelectString($eventdetails, $eventproduct, $eventlocation) { $sql = ''; if ($eventdetails != '' && $eventdetails != -1) $sql .= ' edt.rowid as ed_rowid,'; if ($eventproduct != '' && $eventproduct != -1) $sql .= ' epr.rowid as epr_rowid,'; if ($eventlocation != '' && $eventlocation != -1) $sql .= ' eln.rowid as loc_rowid,'; return $sql; } function completeSqlFromString($eventlocation) { $sql = ""; //if($eventdetails != '' && $eventdetails != -1) $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "eventwizard_eventdetails as edt ON edt.rowid = a.fk_element"; //if($eventproduct != '' && $eventproduct != -1) $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "eventwizard_eventproduct as epr ON epr.fk_eventdetails = edt.rowid"; if ($eventlocation != '' && $eventlocation != -1) $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "eventwizard_eventlocation as eln ON eln.rowid = edt.fk_elventlocation_departure"; return $sql; } function completeSqlWhereString($eventdetails, $eventproduct, $eventlocation) { $sql = ""; if ($eventdetails != '' && $eventdetails != -1) $sql .= " AND edt.rowid = {$eventdetails}"; if ($eventproduct != '' && $eventproduct != -1) $sql .= " AND epr.rowid = {$eventproduct}"; if ($eventlocation != '' && $eventlocation != -1) $sql .= " AND eln.rowid = {$eventlocation}"; return $sql; } }