コード例 #1
0
 public static function mobile_rb_view($tab, $id)
 {
     if (Utils_RecordBrowserCommon::get_access($tab, 'browse') === false) {
         print __('You are not authorised to browse this data.');
         return;
     }
     self::add_recent_entry($tab, Acl::get_user(), $id);
     $rec = self::get_record($tab, $id);
     $access = Utils_RecordBrowserCommon::get_access($tab, 'view', $rec);
     if (is_array($access)) {
         foreach ($access as $k => $v) {
             if (!$v) {
                 $rec[$k] = '';
             }
         }
     }
     $cols = Utils_RecordBrowserCommon::init($tab);
     if (IPHONE) {
         print '<ul class="field">';
         foreach ($cols as $k => $col) {
             $val = Utils_RecordBrowserCommon::get_val($tab, $k, $rec, true, $col);
             if ($val === '') {
                 continue;
             }
             print '<li>' . _V($col['name']) . ': ' . $val . '</li>';
             // TRSL
         }
         print '</ul>';
     } else {
         foreach ($cols as $k => $col) {
             $val = Utils_RecordBrowserCommon::get_val($tab, $k, $rec, true, $col);
             if ($val === '') {
                 continue;
             }
             print _V($col['name']) . ': ' . $val . '<br>';
             // TRSL
         }
     }
     if (Utils_RecordBrowserCommon::get_access($tab, 'edit', $rec)) {
         print '<a ' . (IPHONE ? 'class="button blue" ' : '') . mobile_stack_href(array('Utils_RecordBrowserCommon', 'mobile_rb_edit'), array($tab, $id), __('Record edition')) . '>' . __('Edit') . '</a>' . (IPHONE ? '' : '<br />');
     }
     if (Utils_RecordBrowserCommon::get_access($tab, 'delete', $rec)) {
         print '<a ' . (IPHONE ? 'class="button red" ' : '') . mobile_stack_href(array('Utils_RecordBrowserCommon', 'mobile_rb_delete'), array($tab, $id), __('Record deletion')) . '>' . __('Delete') . '</a>' . (IPHONE ? '' : '<br />');
     }
 }
コード例 #2
0
ファイル: CalendarCommon_0.php プロジェクト: cretzu89/EPESI
 public static function mobile_agenda($time_shift = 0)
 {
     print '<center>' . Base_RegionalSettingsCommon::time2reg(time() + $time_shift, false, true) . ' - ' . Base_RegionalSettingsCommon::time2reg(time() + 7 * 24 * 3600 + $time_shift, false, true) . '</center>';
     CRM_Calendar_EventCommon::$filter = CRM_FiltersCommon::get();
     if ($time_shift) {
         print '<a ' . (IPHONE ? 'class="button red" ' : '') . mobile_stack_href(array('CRM_CalendarCommon', 'mobile_agenda'), array(0)) . '>' . __('Show current week') . '</a>';
     } else {
         print '<a ' . (IPHONE ? 'class="button green" ' : '') . mobile_stack_href(array('CRM_CalendarCommon', 'mobile_agenda'), array(7 * 24 * 60 * 60)) . '>' . __('Show next week') . '</a>';
     }
     Utils_CalendarCommon::mobile_agenda(CRM_Calendar_Event::module_name(), array('custom_agenda_cols' => array(__('Description'), __('Assigned to'), __('Related with'))), $time_shift, array('CRM_CalendarCommon', 'mobile_view_event'));
 }
コード例 #3
0
ファイル: mobile.php プロジェクト: cretzu89/EPESI
$cols_out = array(array('name' => __('Slot'), 'width' => 70), array('name' => __('Pending'), 'width' => 35));
$tray_settings = Utils_TrayCommon::get_trays();
$tray_def = array();
foreach ($tray_settings as $module => $module_settings) {
    foreach ($module_settings as $tab => $tab_settings) {
        $tray = Utils_TrayCommon::get_tray($tab, $tab_settings);
        if (count($tray['__slots__']) == 0) {
            continue;
        }
        $tray_id = Utils_RecordBrowserCommon::get_field_id($tray['__title__']);
        $tray_def += array($tray_id => array('__title__' => $tray['__title__'], '__weight__' => isset($tray['__weight__']) ? $tray['__weight__'] : 0));
        foreach ($tray['__slots__'] as $slot_id => $slot_def) {
            $cap = _V($tray['__title__']) . ' - ' . _V($slot_def['__name__']);
            $sort = isset($tab_settings['__mobile__']['sort']) ? $tab_settings['__mobile__']['sort'] : array();
            $cols = isset($tab_settings['__mobile__']['cols']) ? $tab_settings['__mobile__']['cols'] : array();
            $open = '<a ' . mobile_stack_href(array('Utils_TrayCommon', 'mobile_tray_rb'), array($tab, $slot_def['__crits__'], $sort, $cols), $cap) . '>';
            $close = '</a>';
            $tray_def[$tray_id]['__slots__'][$slot_id]['__weight__'] = isset($slot_def['__weight__']) ? $slot_def['__weight__'] : 0;
            if (IPHONE) {
                $row_info = '';
                $row_info .= '<div>' . _V($tray['__title__']) . '</div><div>' . _V($slot_def['__name__']) . ' (' . $slot_def['__count__'] . ')</div>';
                $row = $open . $row_info . $close;
                $tray_def[$tray_id]['__slots__'][$slot_id]['__html__'] = '<li class="arrow">' . $row . '</li>';
            } else {
                $row = array();
                $row = array($open . _V($tray['__title__']) . '<br>' . _V($slot_def['__name__']) . $close, $slot_def['__count__']);
                $tray_def[$tray_id]['__slots__'][$slot_id]['__html__'] = $row;
            }
        }
    }
}
コード例 #4
0
ファイル: mobile.php プロジェクト: cretzu89/EPESI
function mobile_menu()
{
    $menus = ModuleManager::call_common_methods('mobile_menu');
    global $menus_out, $menus_out_tmp;
    $menus_out = array();
    foreach ($menus as $m => $r) {
        if (!is_array($r)) {
            continue;
        }
        foreach ($r as $cap => $met) {
            if (is_array($met)) {
                if (!isset($met['func'])) {
                    continue;
                }
                $method = array($m . 'Common', $met['func']);
                $args = isset($met['args']) ? $met['args'] : array();
                $weight = isset($met['weight']) ? $met['weight'] : 0;
                $color = isset($met['color']) ? $met['color'] : 'white';
            } else {
                $method = array($m . 'Common', $met);
                $args = array();
                $weight = 0;
                $color = 'white';
            }
            $menus_out[$cap] = array($method, $args, $weight, $color);
        }
    }
    $menus_out_tmp = $menus_out;
    uksort($menus_out, 'sort_menus_cmp');
    foreach ($menus_out as $cap => $met) {
        print '<a ' . mobile_stack_href($met[0], $met[1], $cap) . ' ' . (IPHONE ? ' class="button ' . $met[3] . '"' : '') . '>' . $cap . '</a>' . (IPHONE ? '' : '<br>');
    }
}
コード例 #5
0
ファイル: mobile.php プロジェクト: cretzu89/EPESI
        $cols_out[] = array('name' => $col['name'], 'record' => $col, 'key' => $k);
    }
}
//views
/*if($ret['recent'] && $type!='recent') print('<a '.(IPHONE?'class="button red" ':'').'href="mobile.php?'.http_build_query(array_merge($_GET,array('type'=>'recent','rb_offset'=>0))).'">'.__('Recent').'</a>'.(IPHONE?'':'<br>'));
if($ret['favorites'] && $type!='favorites') print('<a '.(IPHONE?'class="button green" ':'').'href="mobile.php?'.http_build_query(array_merge($_GET,array('type'=>'favorites','rb_offset'=>0))).'">'.__('Favorites').'</a>'.(IPHONE?'':'<br>'));
if(($ret['recent'] || $ret['favorites']) && $type!='all') print('<a '.(IPHONE?'class="button white" ':'').'href="mobile.php?'.http_build_query(array_merge($_GET,array('type'=>'all','rb_offset'=>0))).'">'.__('All').'</a>'.(IPHONE?'':'<br>'));*/
print '<form method="GET" action="mobile.php?' . http_build_query($_GET) . '">';
if (!IPHONE) {
    print '<table width="100%"><tr><td>';
}
if (Utils_RecordBrowserCommon::get_access($table, 'add')) {
    if (IPHONE) {
        print '<a ' . 'class="button green" ' . mobile_stack_href(array('Utils_RecordBrowserCommon', 'mobile_rb_edit'), array($table, false), __('Add record')) . '>' . __('Add') . '</a>';
    } else {
        print '<a ' . mobile_stack_href(array('Utils_RecordBrowserCommon', 'mobile_rb_edit'), array($table, false), __('Add record')) . '><img src="' . Base_ThemeCommon::get_template_file('Utils_RecordBrowser', 'mobile_add.png') . '" border="0"></a>';
    }
}
if (!IPHONE) {
    print '</td><td align="right">';
}
if (IPHONE) {
    print '<ul class="form">';
}
print '<input type="hidden" name="rb_offset" value="0">';
print (IPHONE ? '<li>' : '') . '<select onchange="form.elements[\'search\'].value=\'Search\';form.submit()" name="type"><option value="all"' . ($type == 'all' ? ' selected=1' : '') . '>' . __('All') . '</option><option value="recent"' . ($type == 'recent' ? ' selected=1' : '') . '>' . __('Recent') . '</option><option value="favorites"' . ($type == 'favorites' ? ' selected=1' : '') . '>' . __('Favorites') . '</option></select>' . (IPHONE ? '</li>' : '');
print (IPHONE ? '<li>' : '') . '<input type="text" name="search" value="' . (isset($_GET['search']) ? $_GET['search'] : 'Search') . '" onclick="clickclear(this, \'Search\')" onblur="clickrecall(this,\'Search\')" />' . (IPHONE ? '</li>' : '');
if (IPHONE) {
    print '</ul>';
} else {
    print '<input type="submit" value="OK"/>';
コード例 #6
0
ファイル: CalendarCommon_0.php プロジェクト: cretzu89/EPESI
 public static function mobile_agenda($evmod, $extra_settings = array(), $time_shift = 0, $view_func = null)
 {
     $settings = array('custom_agenda_cols' => null);
     $settings = array_merge($settings, $extra_settings);
     $start = time() + $time_shift;
     $end = $start + 7 * 24 * 60 * 60 + $time_shift;
     if (!IPHONE) {
         $columns = array(array('name' => __('Start'), 'order' => 'start', 'width' => 10), array('name' => __('Duration'), 'order' => 'end', 'width' => 5), array('name' => __('Title'), 'order' => 'title', 'width' => 10));
     }
     //add data
     ob_start();
     $ret_raw = call_user_func(array(str_replace('/', '_', $evmod) . 'Common', 'get_all'), date('Y-m-d', $start), date('Y-m-d', $end));
     ob_get_clean();
     if (!is_array($ret_raw)) {
         trigger_error('Invalid return of event method: get_all (not an array)', E_USER_ERROR);
     }
     if (IPHONE) {
         print '<ul>';
         $date = null;
     } else {
         $data = array();
     }
     $ret = array();
     $i = 0;
     foreach ($ret_raw as $row) {
         $ret[$row['start'] . '_' . $i] = $row;
         $i++;
     }
     ksort($ret);
     foreach ($ret as $row) {
         $ex = Utils_CalendarCommon::process_event($row);
         if ($view_func) {
             $h = mobile_stack_href($view_func, array($row['id']), __('View event'));
         } else {
             $h = '';
         }
         if (IPHONE) {
             if ($date !== $ex['start_date']) {
                 $date = $ex['start_date'];
                 print '</ul><h4>' . $date . '</h4><ul>';
             }
             $start = '<a ' . $h . '>' . $ex['start'] . '</a>';
             $duration = '<a ' . $h . '>' . $ex['duration'] . '</a>';
             $title = '<a ' . $h . '>' . $row['title'] . '</a>';
             print '<li class="arrow">' . $start . $duration . $title . '</li>';
         } else {
             $rrr = array(array('label' => '<a ' . $h . '>' . $ex['start'] . '</a>', 'order_value' => isset($row['timeless']) ? strtotime($row['timeless']) : $row['start']), '<a ' . $h . '>' . $ex['duration'] . '</a>', '<a ' . $h . '>' . $row['title'] . '</a>');
             //				foreach($add_cols as $a)
             //					$rrr[] = $row['custom_agenda_col_'.$a];
             $data[] = $rrr;
         }
     }
     if (IPHONE) {
         print '</ul>';
     } else {
         Utils_GenericBrowserCommon::mobile_table($columns, $data, 'start');
     }
 }