示例#1
0
                        echo getYearViewLayout($calendar_arr) . "####" . getEventInfo($calendar_arr, 'listcnt');
                    } else {
                        die("view:" . $view['view'] . " is not defined");
                    }
                } elseif ($_REQUEST['viewOption'] == 'listview') {
                    $cal_log->debug("going to get calendar Event ListView");
                    //To get Events List
                    $activity_arr = getEventList($calendar_arr, $start_date, $end_date);
                    $activity_list = $activity_arr[0];
                    $navigation_arr = $activity_arr[1];
                    echo constructEventListView($calendar_arr, $activity_list, $navigation_arr) . "####" . getEventInfo($calendar_arr, 'listcnt');
                }
            } elseif ($subtab == 'todo') {
                $cal_log->debug("going to get calendar Todo ListView");
                //To get Todos List
                $todo_arr = getTodoList($calendar_arr, $start_date, $end_date);
                $todo_list = $todo_arr[0];
                $navigation_arr = $todo_arr[1];
                echo constructTodoListView($todo_list, $calendar_arr, $subtab, $navigation_arr) . "####" . getTodoInfo($calendar_arr, 'listcnt');
            }
        } elseif ($type == 'view') {
            checkFileAccess('modules/Calendar/' . $_REQUEST['file'] . '.php');
            require_once 'modules/Calendar/' . $_REQUEST['file'] . '.php';
        } else {
            die("View option is not defined");
        }
    }
} else {
    require_once 'include/Ajax/CommonAjax.php';
    //die("type is not set");
}
示例#2
0
文件: calendarLayout.php 项目: p6/VF
/**
 * Function creates HTML to display Todos ListView
 * @param array  $todo_list     - collection of strings(Todo Information)
 * @param array  $cal           - collection of objects and strings 
 * return string $list_view     - html tags in string format
 */
function constructTodoListView($todo_list, $cal, $subtab, $navigation_array = '')
{
    global $mod_strings, $cal_log, $adb, $theme;
    $cal_log->debug("Entering constructTodoListView() method...");
    global $current_user, $app_strings;
    $date_format = $current_user->date_format;
    $format = $cal['calendar']->hour_format;
    $hour_startat = timeString(array('hour' => date('H:i'), 'minute' => 0), '24');
    $hour_endat = timeString(array('hour' => date('H:i', time() + 60 * 60), 'minute' => 0), '24');
    $time_arr = getaddEventPopupTime($hour_startat, $hour_endat, $format);
    $temp_ts = $cal['calendar']->date_time->ts;
    //to get date in user selected date format
    $temp_date = $date_format == 'dd-mm-yyyy' ? date('d-m-Y', $temp_ts) : ($date_format == 'mm-dd-yyyy' ? date('m-d-Y', $temp_ts) : ($date_format == 'yyyy-mm-dd' ? date('Y-m-d', $temp_ts) : ''));
    if ($cal['calendar']->day_start_hour != 23) {
        $endtemp_date = $temp_date;
    } else {
        $endtemp_ts = $temp_ts + 1 * 24 * 60 * 60;
        $endtemp_date = $date_format == 'dd-mm-yyyy' ? date('d-m-Y', $endtemp_ts) : ($date_format == 'mm-dd-yyyy' ? date('m-d-Y', $endtemp_ts) : ($date_format == 'yyyy-mm-dd' ? date('Y-m-d', $endtemp_ts) : ''));
    }
    $list_view = "";
    //labels of listview header
    if ($cal['view'] == 'day') {
        $colspan = 9;
        $header = array('0' => '#', '1' => $mod_strings['LBL_TIME'], '2' => $mod_strings['LBL_LIST_DUE_DATE'], '3' => $mod_strings['LBL_TODO']);
        $header_width = array('0' => '5%', '1' => '10%', '2' => '10%', '3' => '38%');
        /*if(getFieldVisibilityPermission('Calendar',$current_user->id,'parent_id') == '0')
        		{
        			array_push($header,$mod_strings['LBL_RELATEDTO']);
        			array_push($header_width,'15%');
        		}
        		if(getFieldVisibilityPermission('Calendar',$current_user->id,'contact_id') == '0')
        		{
        			array_push($header,$mod_strings['LBL_CONTACT_NAME']);
        			array_push($header_width,'15%');
        		}*/
        if (getFieldVisibilityPermission('Calendar', $current_user->id, 'taskstatus') == '0') {
            array_push($header, $mod_strings['LBL_STATUS']);
            array_push($header_width, '10%');
        }
        if (isPermitted("Calendar", "EditView") == "yes" || isPermitted("Calendar", "Delete") == "yes") {
            array_push($header, $mod_strings['LBL_ACTION']);
            array_push($header_width, '10%');
        }
        array_push($header, $mod_strings['LBL_ASSINGEDTO']);
        array_push($header_width, '15%');
    } else {
        $colspan = 10;
        $header = array('0' => '#', '1' => $mod_strings['LBL_TIME'], '2' => $mod_strings['LBL_START_DATE'], '3' => $mod_strings['LBL_DUE_DATE'], '4' => $mod_strings['LBL_TODO']);
        $header_width = array('0' => '5%', '1' => '10%', '2' => '10%', '3' => '10%', '4' => '28%');
        /*if(getFieldVisibilityPermission('Calendar',$current_user->id,'parent_id') == '0')
        		{
        			array_push($header,$mod_strings['LBL_RELATEDTO']);
        			array_push($header_width,'15%');
        		}
        		if(getFieldVisibilityPermission('Calendar',$current_user->id,'contact_id') == '0')
        		{
        			array_push($header,$mod_strings['LBL_CONTACT_NAME']);
        			array_push($header_width,'15%');
        		}*/
        if (getFieldVisibilityPermission('Calendar', $current_user->id, 'taskstatus') == '0') {
            array_push($header, $mod_strings['LBL_STATUS']);
            array_push($header_width, '10%');
        }
        if (isPermitted("Calendar", "EditView") == "yes" || isPermitted("Calendar", "Delete") == "yes") {
            array_push($header, $mod_strings['LBL_ACTION']);
        }
        array_push($header, $mod_strings['LBL_ASSINGEDTO']);
        array_push($header_width, '15%');
    }
    if ($current_user->column_fields['is_admin'] == 'on') {
        $Res = $adb->pquery("select * from vtiger_activitytype", array());
    } else {
        $roleid = $current_user->roleid;
        $subrole = getRoleSubordinates($roleid);
        if (count($subrole) > 0) {
            $roleids = $subrole;
            array_push($roleids, $roleid);
        } else {
            $roleids = $roleid;
        }
        if (count($roleids) > 1) {
            $Res = $adb->pquery("select distinct activitytype from  vtiger_activitytype inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_activitytype.picklist_valueid where roleid in (" . generateQuestionMarks($roleids) . ") and picklistid in (select picklistid from vtiger_activitytype) order by sortid asc", array($roleids));
        } else {
            $Res = $adb->pquery("select distinct activitytype from vtiger_activitytype inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_activitytype.picklist_valueid where roleid = ? and picklistid in (select picklistid from vtiger_activitytype) order by sortid asc", array($roleid));
        }
    }
    $eventlist = '';
    for ($i = 0; $i < $adb->num_rows($Res); $i++) {
        $eventlist .= $adb->query_result($Res, $i, 'activitytype') . ";";
    }
    $list_view .= "<table align='center' border='0' cellpadding='5' cellspacing='0' width='98%'>\n\t\t\t<tr><td colspan='3'>&nbsp;</td></tr>";
    //checking permission for Create/Edit Operation
    if (isPermitted("Calendar", "EditView") == "yes") {
        $list_view .= "<tr>\n\t\t\t\t<td class='calAddButton' onMouseOver='fnAddEvent(this,\"addEventDropDown\",\"" . $temp_date . "\",\"" . $endtemp_date . "\",\"" . $time_arr['starthour'] . "\",\"" . $time_arr['startmin'] . "\",\"" . $time_arr['startfmt'] . "\",\"" . $time_arr['endhour'] . "\",\"" . $time_arr['endmin'] . "\",\"" . $time_arr['endfmt'] . "\",\"\",\"" . $subtab . "\",\"" . $eventlist . "\");'style='border: 1px solid #666666;cursor:pointer;height:30px' align='center' width='10%'>\n                                        " . $mod_strings['LBL_ADD'] . "\n                                        <img src='" . vtiger_imageurl('menuDnArrow.gif', $theme) . "' style='padding-left: 5px;' border='0'>                                                                                                                         </td>";
    } else {
        $list_view .= "<tr><td>&nbsp;</td>";
    }
    $list_view .= "<td align='center' width='60%'><span id='total_activities'>" . getTodoInfo($cal, 'listcnt') . "</span>&nbsp;</td>\n\t\t\t\t<td align='right' width='28%'>&nbsp;</td>\n\t\t\t</tr>\n\t\t</table>\n\n\t\t\t<br><table style='background-color: rgb(204, 204, 204);' class='small' align='center' border='0' cellpadding='5' cellspacing='1' width='98%'>\n                        ";
    $header_rows = count($header);
    $navigationOutput = getTableHeaderNavigation($navigation_array, $url_string, "Calendar", "index");
    if ($navigationOutput != '') {
        $list_view .= "<tr width=100% bgcolor=white><td align=center colspan={$header_rows}>";
        $list_view .= "<table align=center width='98%'><tr>" . $navigationOutput . "</tr></table></td></tr>";
    }
    $list_view .= "<tr>";
    for ($i = 0; $i < $header_rows; $i++) {
        $list_view .= "<td class='lvtCol' width='" . $header_width[$i] . "' nowrap='nowrap'>" . $header[$i] . "</td>";
    }
    $list_view .= "</tr>";
    $rows = count($todo_list);
    if ($rows != 0) {
        for ($i = 0; $i < count($todo_list); $i++) {
            $list_view .= "<tr style='height: 25px;' bgcolor='white'>";
            foreach ($todo_list[$i] as $key => $entry) {
                $list_view .= "<td>" . $entry . "</td>";
            }
            $list_view .= "</tr>";
        }
    } else {
        $list_view .= "<tr><td style='background-color:#efefef;height:340px' align='center' colspan='" . $colspan . "'>";
        $list_view .= "<div style='border: 3px solid rgb(153, 153, 153); background-color: rgb(255, 255, 255); width: 45%; position: relative; z-index: 5000;'>\n\t\t\t<table border='0' cellpadding='5' cellspacing='0' width='98%'>\n\t\t\t<tr>\n\t\t\t\t<td rowspan='2' width='25%'>\n\t\t\t\t\t<img src='" . vtiger_imageurl('empty.jpg', $theme) . "' height='60' width='61'></td>\n\t\t\t\t<td style='border-bottom: 1px solid rgb(204, 204, 204);' nowrap='nowrap' width='75%'><span class='genHeaderSmall'>" . $app_strings['LBL_NO'] . " " . $app_strings['Todos'] . " " . $app_strings['LBL_FOUND'] . " !</span></td>\n\t\t\t</tr>\n\t\t\t<tr>";
        //checking permission for Create/Edit Operation
        if (isPermitted("Calendar", "EditView") == "yes") {
            $list_view .= "<td class='small' align='left' nowrap='nowrap'>" . $app_strings['LBL_YOU_CAN_CREATE'] . "&nbsp;" . $app_strings['LBL_A'] . "&nbsp;" . $app_strings['Todo'] . "&nbsp;" . $app_strings['LBL_NOW'] . ".&nbsp;" . $app_strings['LBL_CLICK_THE_LINK'] . "&nbsp;:<br>\n\t\t\t\t\t&nbsp;&nbsp;-<a href='javascript:void(0);' onClick='gshow(\"createTodo\",\"todo\",\"" . $temp_date . "\",\"" . $temp_date . "\",\"" . $time_arr['starthour'] . "\",\"" . $time_arr['startmin'] . "\",\"" . $time_arr['startfmt'] . "\",\"" . $time_arr['endhour'] . "\",\"" . $time_arr['endmin'] . "\",\"" . $time_arr['endfmt'] . "\",\"listview\",\"todo\");'>" . $app_strings['LBL_CREATE'] . " " . $app_strings['LBL_A'] . " " . $app_strings['Todo'] . "</a>\n\t\t\t\t\t</td>";
        } else {
            $list_view .= "<td class='small' align='left' nowrap='nowrap'>" . $app_strings['LBL_YOU_ARE_NOT_ALLOWED_TO_CREATE'] . "&nbsp;" . $app_strings['LBL_A'] . "&nbsp;" . $app_strings['Todo'] . "<br></td>";
        }
        $list_view .= "</tr>\n\t\t\t</table>\n\t\t\t</div>";
        $list_view .= "</td></tr>";
    }
    $list_view .= "</table><br>";
    $cal_log->debug("Exiting constructTodoListView() method...");
    return $list_view;
}