Ejemplo n.º 1
0
/**
 * Show filter form in agenda view
 *
 * @param	Object	$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	$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	$actioncode		Preselected value of actioncode for filter on type
 * @param	int		$usergroupid	Id of group to filter on users
 * @return	void
 */
function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals = array(), $actioncode = '', $usergroupid = '')
{
    global $conf, $user, $langs, $db, $hookmanager;
    global $begin_h, $end_h, $begin_d, $end_d;
    $langs->load("companies");
    // Filters
    print '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
    print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
    print '<input type="hidden" name="year" value="' . $year . '">';
    print '<input type="hidden" name="month" value="' . $month . '">';
    print '<input type="hidden" name="day" value="' . $day . '">';
    print '<input type="hidden" name="action" value="' . $action . '">';
    print '<input type="hidden" name="showbirthday" value="' . $showbirthday . '">';
    print '<div class="fichecenter">';
    if (!empty($conf->browser->phone)) {
        print '<div class="fichehalfleft">';
    } else {
        print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
    }
    print '<table class="nobordernopadding">';
    if ($canedit) {
        print '<tr>';
        print '<td class="nowrap">';
        print $langs->trans("ActionsToDoBy") . ' &nbsp; ';
        print '</td><td class="nowrap maxwidthonsmartphone">';
        print $form->select_dolusers($filtert, 'usertodo', 1, '', !$canedit);
        if (empty($conf->dol_optimize_smallscreen)) {
            print ' &nbsp; ' . $langs->trans("or") . ' ' . $langs->trans("Group") . ' &nbsp; ';
        }
        print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', !$canedit);
        print '</td></tr>';
        include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
        $formactions = new FormActions($db);
        print '<tr>';
        print '<td class="nowrap">';
        print $langs->trans("Type");
        print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone">';
        print $formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0);
        print '</td></tr>';
        print '<tr>';
        print '<td class="nowrap">';
        print $langs->trans("Status");
        print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone">';
        $formactions->form_select_status_action('formaction', $status, 1, 'status', 1, 2);
        print '</td></tr>';
    }
    if (!empty($conf->societe->enabled) && $user->rights->societe->lire) {
        print '<tr>';
        print '<td class="nowrap">';
        print $langs->trans("ThirdParty") . ' &nbsp; ';
        print '</td><td class="nowrap maxwidthonsmartphone">';
        print $form->select_thirdparty($socid, 'socid');
        print '</td></tr>';
    }
    if (!empty($conf->projet->enabled) && $user->rights->projet->lire) {
        require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
        $formproject = new FormProjets($db);
        print '<tr>';
        print '<td class="nowrap">';
        print $langs->trans("Project") . ' &nbsp; ';
        print '</td><td class="nowrap maxwidthonsmartphone">';
        $formproject->select_projects($socid ? $socid : -1, $pid, 'projectid');
        print '</td></tr>';
    }
    if ($canedit && $action == 'show_peruser') {
        // Filter on hours
        print '<tr>';
        print '<td class="nowrap">' . $langs->trans("WorkingTimeRange") . '</td>';
        print "<td class='nowrap maxwidthonsmartphone'>";
        print '<input type="number" class="short" name="begin_h" value="' . $begin_h . '" min="0" max="23">';
        if (empty($conf->dol_use_jmobile)) {
            print ' - ';
        }
        print '<input type="number" class="short" name="end_h" value="' . $end_h . '" min="1" max="24">';
        if (empty($conf->dol_use_jmobile)) {
            print ' ' . $langs->trans("H");
        }
        print '</td></tr>';
        // Filter on days
        print '<tr>';
        print '<td class="nowrap">' . $langs->trans("WorkingDaysRange") . '</td>';
        print "<td class='nowrap maxwidthonsmartphone'>";
        print '<input type="number" class="short" name="begin_d" value="' . $begin_d . '" min="1" max="7">';
        if (empty($conf->dol_use_jmobile)) {
            print ' - ';
        }
        print '<input type="number" class="short" name="end_d" value="' . $end_d . '" min="1" max="7">';
        print '</td></tr>';
    }
    // Hooks
    $parameters = array('canedit' => $canedit, 'pid' => $pid, 'socid' => $socid);
    $reshook = $hookmanager->executeHooks('searchAgendaFrom', $parameters, $object, $action);
    // Note that $action and $object may have been
    print '</table>';
    if (!empty($conf->browser->phone)) {
        print '</div>';
    } else {
        print '</td>';
    }
    if (!empty($conf->browser->phone)) {
        print '<div class="fichehalfright">';
    } else {
        print '<td align="center" valign="middle" class="nowrap">';
    }
    print '<table><tr><td align="center">';
    print '<div class="formleftzone">';
    print '<input type="submit" class="button" style="min-width:120px" name="refresh" value="' . $langs->trans("Refresh") . '">';
    print '</div>';
    print '</td></tr>';
    print '</table>';
    if (!empty($conf->browser->phone)) {
        print '</div>';
    } else {
        print '</td></tr></table>';
    }
    print '</div>';
    // Close fichecenter
    print '<div style="clear:both"></div>';
    print '</form>';
}
Ejemplo n.º 2
0
 if (isset($_GET['status']) || isset($_POST['status'])) {
     $percent = GETPOST('status');
 } else {
     if (isset($_GET['percentage']) || isset($_POST['percentage'])) {
         $percent = GETPOST('percentage');
     } else {
         if (GETPOST('complete') == '0' || GETPOST("afaire") == 1) {
             $percent = '0';
         } else {
             if (GETPOST('complete') == 100 || GETPOST("afaire") == 2) {
                 $percent = 100;
             }
         }
     }
 }
 $formactions->form_select_status_action('formaction', $percent, 1, 'complete');
 print '</td></tr>';
 // Location
 if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
     print '<tr><td>' . $langs->trans("Location") . '</td><td colspan="3"><input type="text" name="location" size="50" value="' . (GETPOST('location') ? GETPOST('location') : $object->location) . '"></td></tr>';
 }
 // Assigned to
 print '<tr><td class="tdtop nowrap">' . $langs->trans("ActionAffectedTo") . '</td><td>';
 $listofuserid = array();
 if (empty($donotclearsession)) {
     $assignedtouser = GETPOST("assignedtouser") ? GETPOST("assignedtouser") : (!empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : $user->id);
     if ($assignedtouser) {
         $listofuserid[$assignedtouser] = array('id' => $assignedtouser, 'mandatory' => 0, 'transparency' => $object->transparency);
     }
     // Owner first
     $_SESSION['assignedtouser'] = json_encode($listofuserid);
Ejemplo n.º 3
0
print '</td></tr>' . "\n";
// AGENDA_DEFAULT_FILTER_TYPE
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<td>' . $langs->trans("AGENDA_DEFAULT_FILTER_TYPE") . '</td>' . "\n";
print '<td align="center">&nbsp;</td>' . "\n";
print '<td align="right" class="nowrap">' . "\n";
$formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0, 1);
print '</td></tr>' . "\n";
// AGENDA_DEFAULT_FILTER_STATUS
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<td>' . $langs->trans("AGENDA_DEFAULT_FILTER_STATUS") . '</td>' . "\n";
print '<td align="center">&nbsp;</td>' . "\n";
print '<td align="right">' . "\n";
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2);
print '</td></tr>' . "\n";
// AGENDA_DEFAULT_VIEW
$var = !$var;
print '<tr ' . $bc[$var] . '>' . "\n";
print '<td>' . $langs->trans("AGENDA_DEFAULT_VIEW") . '</td>' . "\n";
print '<td align="center">&nbsp;</td>' . "\n";
print '<td align="right">' . "\n";
$tmplist = array('show_month' => $langs->trans("ViewCal"), 'show_week' => $langs->trans("ViewWeek"), 'show_day' => $langs->trans("ViewDay"), 'show_list' => $langs->trans("ViewList"), 'show_peruser' => $langs->trans("ViewPerUser"));
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
print '</td></tr>' . "\n";
print '</table>';
dol_fiche_end();
print '<div class="center"><input class="button" type="submit" name="save" value="' . dol_escape_htmltag($langs->trans("Save")) . '"></div>';
print '</form>';
print "<br>";