Example #1
0
function get_arr_knd_with_time($group, $user, $in, $out)
{
    global $kga, $conn;
    $arr_knds = get_arr_knd($group);
    $arr_time = get_arr_time_knd($user, $in, $out);
    $arr = array();
    $i = 0;
    foreach ($arr_knds as $knd) {
        $arr[$i]['knd_ID'] = $knd['knd_ID'];
        $arr[$i]['knd_name'] = $knd['knd_name'];
        $arr[$i]['knd_visible'] = $knd['knd_visible'];
        if (isset($arr_time[$knd['knd_ID']])) {
            $arr[$i]['zeit'] = formatDuration($arr_time[$knd['knd_ID']]);
        } else {
            $arr[$i]['zeit'] = formatDuration(0);
        }
        $i++;
    }
    return $arr;
}
Example #2
0
     } else {
         $tpl->assign('arr_usr', 0);
     }
     $tpl->display("../lists/usr.tpl");
     break;
     /**
      * Return a list of customers. A customer can only see himself.
      */
 /**
  * Return a list of customers. A customer can only see himself.
  */
 case 'reload_knd':
     if (isset($kga['customer'])) {
         $arr_knd = array(array('knd_ID' => $kga['customer']['knd_ID'], 'knd_name' => $kga['customer']['knd_name'], 'knd_visible' => $kga['customer']['knd_visible']));
     } else {
         $arr_knd = get_arr_knd($kga['usr']['usr_grp']);
     }
     if (count($arr_knd) > 0) {
         $tpl->assign('arr_knd', $arr_knd);
     } else {
         $tpl->assign('arr_knd', 0);
     }
     $tpl->display("../lists/knd.tpl");
     break;
     /**
      * Return a list of projects. Customers are only shown their projects.
      */
 /**
  * Return a list of projects. Customers are only shown their projects.
  */
 case 'reload_pct':
Example #3
0
/**
 * Returns array for smarty's html_options funtion.
 *
 * <pre>
 * returns:
 * [0] -> pct/evt names
 * [1] -> values as IDs
 * </pre>
 *
 * @param string either 'pct', 'evt', 'knd', 'grp'
 * @return array
 * @author th, sl, kp
 */
function makeSelectBox($subject, $user, $selection = null)
{
    global $kga;
    $sel = array();
    $sel[0] = array();
    $sel[1] = array();
    switch ($subject) {
        case 'pct':
            $arr_pct = get_arr_pct($user);
            $i = 0;
            foreach ($arr_pct as $pct) {
                if ($pct['pct_visible']) {
                    if ($kga['conf']['flip_pct_display']) {
                        $sel[0][$i] = $pct['knd_name'] . ": " . $pct['pct_name'];
                        if ($kga['conf']['pct_comment_flag']) {
                            $sel[0][$i] .= "(" . $pct['pct_comment'] . ")";
                        }
                    } else {
                        $sel[0][$i] = $pct['pct_name'] . " (" . $pct['knd_name'] . ")";
                        if ($kga['conf']['pct_comment_flag']) {
                            $sel[0][$i] .= "(" . $pct['pct_comment'] . ")";
                        }
                    }
                    $sel[1][$i] = $pct['pct_ID'];
                    $i++;
                }
            }
            break;
        case 'evt':
            $arr_evt = get_arr_evt($user);
            $i = 0;
            foreach ($arr_evt as $evt) {
                if ($evt['evt_visible']) {
                    $sel[0][$i] = $evt['evt_name'];
                    $sel[1][$i] = $evt['evt_ID'];
                    $i++;
                }
            }
            break;
        case 'knd':
            $arr_knd = get_arr_knd($user);
            $i = 0;
            $selectionFound = false;
            foreach ($arr_knd as $knd) {
                if ($knd['knd_visible']) {
                    $sel[0][$i] = $knd['knd_name'];
                    $sel[1][$i] = $knd['knd_ID'];
                    $i++;
                    if ($selection == $knd['knd_ID']) {
                        $selectionFound = true;
                    }
                }
            }
            if ($selection != null && !$selectionFound) {
                $data = knd_get_data($selection);
                $sel[0][$i] = $data['knd_name'];
                $sel[1][$i] = $data['knd_ID'];
            }
            break;
        case 'grp':
            $arr_grp = get_arr_grp();
            $i = 0;
            foreach ($arr_grp as $grp) {
                if (!$grp['grp_trash']) {
                    $sel[0][$i] = $grp['grp_name'];
                    $sel[1][$i] = $grp['grp_ID'];
                    $i++;
                }
            }
            break;
        default:
            // TODO leave default options empty ???
            break;
    }
    return $sel;
}