Ejemplo n.º 1
0
 public static function getInstance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Ejemplo n.º 2
0
 public function show($error = null)
 {
     $system = System::getInstance();
     $ui = Ui::getInstance();
     $ui->createPage();
     // Header
     $logo = "<img src='../images/integria_logo_header.png' style='border:0px;' alt='Home' >";
     $title = "<div style='text-align:center;'>{$logo}</div>";
     $hide_logout = $system->getRequest("hide_logout", false);
     if ($hide_logout) {
         $left_button = "";
     } else {
         $left_button = $ui->createHeaderButton(array('icon' => 'back', 'pos' => 'left', 'text' => __('Exit'), 'href' => 'index.php?action=logout'));
     }
     $ui->createHeader($title, $left_button, null, "logo");
     $ui->showFooter();
     $ui->beginContent();
     //List of buttons
     // Workunits
     $options = array('icon' => 'star', 'pos' => 'right', 'text' => __('Workunits'), 'href' => 'index.php?page=workunit');
     $ui->contentAddHtml($ui->createButton($options));
     // Workorders
     $options = array('icon' => 'info', 'pos' => 'right', 'text' => __('Workorders'), 'href' => 'index.php?page=workorders&filter_status=0&filter_owner=' . $system->getConfig('id_user'));
     $ui->contentAddHtml($ui->createButton($options));
     // Incidents
     $options = array('icon' => 'alert', 'pos' => 'right', 'text' => __('Incidents'), 'href' => 'index.php?page=incidents');
     $ui->contentAddHtml($ui->createButton($options));
     // Calendars
     $options = array('icon' => 'grid', 'pos' => 'right', 'text' => __('Calendars'), 'href' => 'index.php?page=calendars');
     $ui->contentAddHtml($ui->createButton($options));
     if (!empty($error)) {
         $options = array('popup_id' => 'error_popup');
         $ui->addWarningPopup($options);
         $ui->contentAddHtml("<script type=\"text/javascript\">\n\t\t\t\t\t\t\t\t\t\t\$(document).on('pageshow', function() {\n\t\t\t\t\t\t\t\t\t\t\t\$(\"#error_popup\").popup(\"open\");\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t</script>");
     }
     $ui->endContent();
     $ui->showPage();
     return;
 }
Ejemplo n.º 3
0
 private function showWorkOrder($message = "")
 {
     $system = System::getInstance();
     $ui = Ui::getInstance();
     $ui->createPage();
     $back_href = "index.php?page=workorders&filter_status=0&filter_owner=" . $system->getConfig('id_user');
     if ($this->id_workorder < 0) {
         $title = __("Workorder");
     } else {
         $title = __("Workorder") . "&nbsp;#" . $this->id_workorder;
     }
     $ui->createDefaultHeader($title, $ui->createHeaderButton(array('icon' => 'back', 'pos' => 'left', 'text' => __('Back'), 'href' => $back_href)));
     $ui->beginContent();
     // Message popup
     if ($message != "") {
         $options = array('popup_id' => 'message_popup', 'popup_content' => $message);
         $ui->addPopup($options);
         $ui->contentAddHtml("<script type=\"text/javascript\">\n\t\t\t\t\t\t\t\t\t\t\$(document).on('pageshow', function() {\n\t\t\t\t\t\t\t\t\t\t\t\$(\"#message_popup\").popup(\"open\");\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t</script>");
     }
     $options = array('id' => 'form-workorder', 'action' => "index.php?page=workorder", 'method' => 'POST');
     $ui->beginForm($options);
     // Title
     $options = array('name' => 'title', 'label' => __('Title'), 'value' => $this->title, 'placeholder' => __('Title'));
     $ui->formAddInputText($options);
     // Assigned user
     $options = array('name' => 'assigned_user', 'id' => 'text-assigned_user', 'label' => __('Assigned user'), 'value' => $this->assigned_user, 'placeholder' => __('Assigned user'), 'autocomplete' => 'off');
     $ui->formAddInputText($options);
     // Assigned user autocompletion
     // List
     $ui->formAddHtml("<ul id=\"ul-autocomplete\" data-role=\"listview\" data-inset=\"true\"></ul>");
     // Autocomplete binding
     $ui->bindMobileAutocomplete("#text-assigned_user", "#ul-autocomplete");
     // Status
     $values = array();
     if (get_db_value("need_external_validation", "ttodo", "id", $this->id_workorder)) {
         $values = wo_status_array(0);
     } else {
         $values = wo_status_array(1);
     }
     $options = array('name' => 'status', 'title' => __('Status'), 'label' => __('Status'), 'items' => $values, 'selected' => $this->status);
     $ui->formAddSelectBox($options);
     // Priority
     $values = array();
     $values = get_priorities();
     $options = array('name' => 'priority', 'title' => __('Priority'), 'label' => __('Priority'), 'items' => $values, 'selected' => $this->priority);
     $ui->formAddSelectBox($options);
     // Category
     $workorders = get_db_all_rows_sql("SELECT id, name FROM two_category ORDER BY name");
     $values = array();
     if ($workorders) {
         foreach ($workorders as $workorder) {
             $values[$workorder[0]] = $workorder[1];
         }
     }
     array_unshift($values, __('Any'));
     $options = array('name' => 'category', 'title' => __('Category'), 'label' => __('Category'), 'items' => $values, 'selected' => $this->category);
     $ui->formAddSelectBox($options);
     // Task
     $sql = "SELECT ttask.id, tproject.name, ttask.name\n\t\t\t\t\t\tFROM ttask, trole_people_task, tproject\n\t\t\t\t\t\tWHERE ttask.id_project = tproject.id\n\t\t\t\t\t\t\tAND tproject.disabled = 0\n\t\t\t\t\t\t\tAND ttask.id = trole_people_task.id_task\n\t\t\t\t\t\t\tAND trole_people_task.id_user = '******'id_user') . "'\n\t\t\t\t\t\tORDER BY tproject.name, ttask.name";
     if (dame_admin($system->getConfig('id_user'))) {
         $sql = "SELECT ttask.id, tproject.name, ttask.name \n\t\t\t\t\t\t\tFROM ttask, tproject\n\t\t\t\t\t\t\tWHERE ttask.id_project = tproject.id\n\t\t\t\t\t\t\t\tAND tproject.disabled = 0\n\t\t\t\t\t\t\tORDER BY tproject.name, ttask.name";
     }
     $tasks = get_db_all_rows_sql($sql);
     $values = array();
     $values[0] = __('N/A');
     if ($tasks) {
         foreach ($tasks as $task) {
             $values[$task[0]] = array('optgroup' => $task[1], 'name' => $task[2]);
         }
     }
     $selected = $this->id_task > 0 ? $this->id_task : 0;
     $options = array('name' => 'id_task', 'title' => __('Task'), 'label' => __('Task'), 'items' => $values, 'selected' => $selected);
     $ui->formAddSelectBox($options);
     // Description
     $options = array('name' => 'description', 'label' => __('Description'), 'value' => $this->description);
     $ui->formAddHtml($ui->getTextarea($options));
     // Hidden operation (insert or update+id)
     if ($this->id_workorder < 0) {
         $options = array('type' => 'hidden', 'name' => 'operation', 'value' => 'insert');
         $ui->formAddInput($options);
         // Submit button
         $options = array('text' => __('Add'), 'data-icon' => 'plus');
         $ui->formAddSubmitButton($options);
     } else {
         $options = array('type' => 'hidden', 'name' => 'operation', 'value' => 'update');
         $ui->formAddInput($options);
         $options = array('type' => 'hidden', 'name' => 'id_workorder', 'value' => $this->id_workorder);
         $ui->formAddInput($options);
         // Submit button
         $options = array('text' => __('Update'), 'data-icon' => 'refresh');
         $ui->formAddSubmitButton($options);
     }
     $ui->endForm();
     $ui->endContent();
     // Foooter buttons
     // Add
     if ($this->id_workorder < 0) {
         $button_add = "<a onClick=\"\$('#form-workorder').submit();\" data-role='button' data-icon='plus'>" . __('Add') . "</a>\n";
     } else {
         $button_add = "<a onClick=\"\$('#form-workorder').submit();\" data-role='button' data-icon='refresh'>" . __('Update') . "</a>\n";
     }
     // Delete
     $workorder_creator = get_db_value("created_by_user", "ttodo", "id", $this->id_workorder);
     if ($this->id_workorder > 0 && (dame_admin($system->getConfig('id_user')) || $system->getConfig('id_user') == $workorder_creator)) {
         $button_delete = "<a href='index.php?page=workorders&operation=delete&id_workorder=" . $this->id_workorder . "\n\t\t\t\t\t\t\t\t\t&filter_status=0&filter_owner=" . $system->getConfig('id_user') . "' data-ajax='false'\n\t\t\t\t\t\t\t\t\tdata-role='button' data-icon='delete'>" . __('Delete') . "</a>\n";
     }
     $ui->createFooter("<div data-type='horizontal' data-role='controlgroup'>{$button_add}" . "{$button_delete}</div>");
     $ui->showFooter();
     $ui->showPage();
 }
Ejemplo n.º 4
0
//默认配置
/** @constant 要被处理的源代码路径 */
define("CODE_PATH", "./src/obj/");
/** @constant tangram 代码路径 */
define("TANGRAM_PATH", "./src/");
/** @constant Tangram-base 所在目录 */
define("TANGRAM_BASE_DIR", "tangram/");
/** @constant Tangram命名空间 */
define("TANGRAM_NAMESPACE", "baidu");
/** @constant 处理的文件类型 */
define("FILETYPES", ".html,.htm,.js,.tpl");
//处理传进来的参数
$param = isset($argv) ? $argv : $_REQUEST;
$paramsHandler = new HandleParams($param);
$config = $paramsHandler->run();
//如果用户是通过浏览器访问,则显示web界面。否则为命令行模式
if ($config['type'] == "web") {
    $uiHandler = new Ui($config);
    $uiHandler->run();
}
if (!empty($config["params"]) || $config['type'] == "commandline") {
    //解析用户的源代码,提取其中调用Tangram的代码
    $parseHandler = new Parse($config);
    $parseRes = $parseHandler->run();
    //分析用户调用的tangram源代码,得到用户需要的tangram模块
    $indexHandler = new Index($parseRes, $config);
    $indexRes = $indexHandler->run();
    //将用户用到的tangram模块打包返回给用户
    $packHandler = new Pack($indexRes, $config);
    $packHandler->run();
}
Ejemplo n.º 5
0
    public function showWorkUnits($message = "")
    {
        $system = System::getInstance();
        $ui = Ui::getInstance();
        $ui->createPage();
        // Header
        $back_href = 'index.php?page=workunit';
        $ui->createDefaultHeader(__("Workunits"), $ui->createHeaderButton(array('icon' => 'back', 'pos' => 'left', 'text' => __('Back'), 'href' => $back_href)));
        // Content
        $ui->beginContent();
        // Message popup
        if ($message != "") {
            $options = array('popup_id' => 'message_popup', 'popup_content' => $message);
            $ui->addPopup($options);
            $ui->contentAddHtml("<script type=\"text/javascript\">\n\t\t\t\t\t\t\t\t\t\t\$(document).on('pageshow', function() {\n\t\t\t\t\t\t\t\t\t\t\t\$(\"#message_popup\").popup(\"open\");\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t</script>");
        }
        // Workunits listing
        $html = $this->getWorkUnitsList("", false);
        $ui->contentAddHtml($html);
        if ($this->getCountWorkUnits() > $system->getPageSize()) {
            $ui->contentAddHtml('<div style="text-align:center;" id="loading_rows">
										<img src="../images/spinner.gif">&nbsp;' . __('Loading...') . '</img>
									</div>');
            $this->addWorkUnitsLoader();
        }
        $ui->endContent();
        // Foooter buttons
        // New
        $button_new = "<a href='index.php?page=workunit' data-role='button'\n\t\t\t\t\t\t\tdata-ajax='false' data-icon='plus'>" . __('New') . "</a>\n";
        // Pagination
        //$paginationCG = $ui->getPaginationControgroup("workunits", $this->offset, $this->getNumPages());
        $ui->createFooter($button_new);
        $ui->showFooter();
        $ui->showPage();
    }
Ejemplo n.º 6
0
	private function showIncidents ($message = "") {
		
		$system = System::getInstance();
		$ui = Ui::getInstance();
		
		$ui->createPage();
		
		$back_href = 'index.php?page=home';
		$ui->createDefaultHeader(__("Tickets"),
			$ui->createHeaderButton(
				array('icon' => 'back',
					'pos' => 'left',
					'text' => __('Back'),
					'href' => $back_href)));
		$ui->beginContent();
			
			// Message popup
			if ($message != "") {
				$options = array(
					'popup_id' => 'message_popup',
					'popup_custom' => true,
					'popup_content' => $message
					);
				$ui->addPopup($options);
				$ui->contentAddHtml("<script type=\"text/javascript\">
										$(document).on('pageshow', function() {
											$(\"div.popup-back\")
												.click(function (e) {
													e.preventDefault();
													$(this).remove();
												})
												.show();
										});
									</script>");
			}
			
			$ui->contentBeginCollapsible(__('Filter'));
				$options = array(
					'action' => "index.php?page=incidents",
					'method' => 'POST',
					'data-ajax' => 'false'
					);
				$ui->beginForm($options);
					// Filter search
					$options = array(
						'name' => 'filter_search',
						'label' => __('Search'),
						'value' => $this->filter_search
						);
					$ui->formAddInputSearch($options);
					// Filter status
					$values = array();
					$values[0] = __('Any');
					$values[-10] = __('Not closed');
					$status_table = process_sql ("select * from tincident_status");
					foreach ($status_table as $status) {
						$values[$status['id']] = __($status['name']);
					} 
					
					$options = array(
						'name' => 'filter_status',
						'title' => __('Status'),
						'label' => __('Status'),
						'items' => $values,
						'selected' => $this->filter_status
						);
					$ui->formAddSelectBox($options);
					// Filter owner
					$options = array(
						'name' => 'filter_owner',
						'id' => 'text-filter_owner',
						'label' => __('Owner'),
						'value' => $this->filter_owner,
						'placeholder' => __('Owner'),
						'autocomplete' => 'off'
						);
					$ui->formAddInputText($options);
						// Owner autocompletion
						// List
						$ui->formAddHtml("<ul id=\"ul-autocomplete_owner\" data-role=\"listview\" data-inset=\"true\"></ul>");
						// Autocomplete binding
						$ui->bindMobileAutocomplete("#text-filter_owner", "#ul-autocomplete_owner");
					$options = array(
						'name' => 'submit_button',
						'text' => __('Apply filter'),
						'data-icon' => 'search'
						);
					$ui->formAddSubmitButton($options);
				$form_html = $ui->getEndForm();
			$ui->contentCollapsibleAddItem($form_html);
			$ui->contentEndCollapsible("collapsible-filter", "d");
			// Incidents listing
			$html = $this->getIncidentsList();
			$ui->contentAddHtml($html);
			if ($this->getCountIncidents() > $system->getPageSize()) {
				$ui->contentAddHtml('<div style="text-align:center;" id="loading_rows">
										<img src="../images/spinner.gif">&nbsp;'
											. __('Loading...') .
										'</img>
									</div>');
				$this->addIncidentsLoader();
			}
		$ui->endContent();
		// Foooter buttons
		// New
		$button_new = "<a href='index.php?page=incident' data-role='button'
							data-ajax='false' data-icon='plus'>".__('New')."</a>\n";
		// Pagination
		// $filter = "";
		// if ($this->filter_search != '') {
		// 	$filter .= "&filter_search=".$this->filter_search;
		// }
		// if ($this->filter_status) {
		// 	$filter .= "&filter_status=".$this->filter_status;
		// }
		// if ($this->filter_owner != '') {
		// 	$filter .= "&filter_owner=".$this->filter_owner;
		// }
		// $paginationCG = $ui->getPaginationControgroup("incidents$filter", $this->offset, $this->getNumPages());
		$ui->createFooter($button_new);
		$ui->showFooter();
		$ui->showPage();
	}
Ejemplo n.º 7
0
	public function getAgenda () {
		$system = System::getInstance();
		$ui = Ui::getInstance();

		$html = "<div id='calendar'></div>";
		$html .= "	<link href='" . $system->getConfig("homedir") . "/include/js/fullcalendar/fullcalendar.css' rel='stylesheet' />
					<link href='" . $system->getConfig("homedir") . "/include/js/fullcalendar/fullcalendar.print.css' rel='stylesheet' media='print' />
					<script src='" . $system->getConfig("homedir") . "/include/js/fullcalendar/fullcalendar.min.js'></script>

					<script>
						
						function get_non_working_days (year) {
							var res;
							
							$.ajax({
								url: \"" . $system->getConfig("homedir") . "/ajax.php\",
								data: {
									page: \"include/ajax/calendar\",
									get_non_working_days: true,
									year: year
								},
								dataType: 'json',
								async: false,
								type: \"POST\",
								success: function(data) {
									res = data;
								}
							});
							
							return res;
						}
						
						$(document).ready(function() {
						
					        var show_projects = $show_projects;
					        var show_tasks = $show_tasks;
					        var show_wo = $show_wo;
					        var show_events = $show_events;
					        
					        var non_working_days = null;
					        var today = new Date();
					        var year = today.getFullYear();
					        var dateYmd;
					        var dd;
					        var mm;
					        var yyyy;
					        
					        // Today date to 'Ymd'
					        dd = today.getDate();
							if (dd < 10) dd = '0'+dd;
							mm = today.getMonth()+1;
							if (mm < 10) mm = '0'+mm;
							yyyy = today.getFullYear();
					        today = yyyy+'-'+mm+'-'+dd;
					        
							$('#calendar').fullCalendar({
								header: {
									left: 'today',
									center: 'prev,title,next',
									right: 'month,agendaWeek,agendaDay'
								},
								buttonText: {
									prev: '<img src=\"" . $system->getConfig("homedir") . "/images/control_rewind_blue.png\" title=\"" . __("Prev") . "\" class=\"calendar_arrow\">',
					   				next: '<img src=\"" . $system->getConfig("homedir") . "/images/control_fastforward_blue.png\" title=\"" . __("Prev") . "\" class=\"calendar_arrow\">',
					   			},
					            firstDay: 1,
								editable: false,
								events: function(start, end, callback) {
									var date_aux = new Date(start);
					        		var start_time = date_aux.getTime();

					        		start_time = start_time/1000; //Convert from miliseconds to seconds
					        			
					        		date_aux = new Date(end);
					        		var end_time = date_aux.getTime();

					        		end_time = end_time/1000; //Convert from miliseconds to seconds

					                var url_source = '" . $system->getConfig("homedir") . "/ajax.php?page=include/ajax/calendar&get_events=1&ajax=1&start_date='+start_time+'&end_date='+end_time;
					                url_source += '&show_projects='+show_projects+'&show_events='+show_events+'&show_wo='+show_wo+'&show_tasks='+show_tasks;
									
					        		$.ajax({
					            		url: url_source,
					            		dataType: 'json',
					            		type: \"POST\",
					            		success: function(data) {
					                		var events = [];
					                		
					                		$(data).each(function() {
					                			
					                			var obj = $(this);
					                			var title_str = obj[0].name;
					                			var start_str = obj[0].start;
					                			var end_str = obj[0].end;
					                			var bgColor = obj[0].bgColor;
					                			var allDayEvent = obj[0].allDay;
					                			var link = obj[0].url;

					                			//Convert dates to JS object date
					                			start_date = new Date(start_str*1000);

					                			var end_date = start_date;
					                            
					                			if (end_str && (end_str != \"0000-00-00 00:00:00\")) {
					                				end_date = new Date(end_str*1000);                			
					                			}
					                            
					                    		events.push({title: title_str, start: start_date, end: end_date, color: bgColor, allDay: allDayEvent, url: link});
					                		});
					                		callback(events);
					            		}
					        		});
					    		},
					    		dayRender: function (date, cell) {
									if (non_working_days == null || year != date.getFullYear()) {
										year = date.getFullYear();
										non_working_days = get_non_working_days(year);
									}
									// To 'Y-m-d' format
									dd = date.getDate();
									if (dd < 10) dd = '0'+dd;
									mm = date.getMonth()+1;
									if (mm < 10) mm = '0'+mm;
									yyyy = date.getFullYear();
									date = yyyy+'-'+mm+'-'+dd;
									
									if ($.inArray(date, non_working_days) >= 0 && date != today) {
										// Highlight the non working day
										cell.css('background', '#F3F3F3');
									}
								}
							});
						});

					</script>";

		return $html;
	}
Ejemplo n.º 8
0
    private function showWorkOrders($message = "")
    {
        $system = System::getInstance();
        $ui = Ui::getInstance();
        $ui->createPage();
        $back_href = 'index.php?page=home';
        $ui->createDefaultHeader(__("Workorders"), $ui->createHeaderButton(array('icon' => 'back', 'pos' => 'left', 'text' => __('Back'), 'href' => $back_href)));
        $ui->beginContent();
        // Message popup
        if ($message != "") {
            $options = array('popup_id' => 'message_popup', 'popup_content' => $message);
            $ui->contentAddHtml($ui->getPopupHTML($options));
            $ui->contentAddHtml("<script type=\"text/javascript\">\n\t\t\t\t\t\t\t\t\t\t\$(document).on('pageshow', function() {\n\t\t\t\t\t\t\t\t\t\t\t\$(\"#message_popup\").popup(\"open\");\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t</script>");
        }
        $ui->contentBeginCollapsible(__('Filter'));
        $options = array('action' => "index.php?page=workorders", 'method' => 'POST', 'data-ajax' => 'false');
        $ui->beginForm($options);
        // Filter search
        $options = array('name' => 'filter_search', 'label' => __('Search'), 'value' => $this->filter_search);
        $ui->formAddInputSearch($options);
        // Filter owner
        $options = array('name' => 'filter_owner', 'id' => 'text-filter_owner', 'label' => __('Owner'), 'value' => $this->filter_owner, 'placeholder' => __('Owner'), 'autocomplete' => 'off');
        $ui->formAddInputText($options);
        // Owner autocompletion
        // List
        $ui->formAddHtml("<ul id=\"ul-autocomplete_owner\" data-role=\"listview\" data-inset=\"true\"></ul>");
        // Autocomplete binding
        $ui->bindMobileAutocomplete("#text-filter_owner", "#ul-autocomplete_owner");
        // Filter creator
        $options = array('name' => 'filter_creator', 'id' => 'text-filter_creator', 'label' => __('Creator'), 'value' => $this->filter_creator, 'placeholder' => __('Creator'), 'autocomplete' => 'off');
        $ui->formAddInputText($options);
        // Creator autocompletion
        // List
        $ui->formAddHtml("<ul id=\"ul-autocomplete_creator\" data-role=\"listview\" data-inset=\"true\"></ul>");
        // Autocomplete binding
        $ui->bindMobileAutocomplete("#text-filter_creator", "#ul-autocomplete_creator");
        // Filter status
        $values = array();
        $values[-1] = __('Any');
        $values[0] = __('Pending');
        $values[1] = __('Finished');
        $values[2] = __('Validated');
        $options = array('name' => 'filter_status', 'title' => __('Status'), 'label' => __('Status'), 'items' => $values, 'selected' => $this->filter_status);
        $ui->formAddSelectBox($options);
        $options = array('name' => 'submit_button', 'text' => __('Apply filter'), 'data-icon' => 'search');
        $ui->formAddSubmitButton($options);
        $form_html = $ui->getEndForm();
        $ui->contentCollapsibleAddItem($form_html);
        $ui->contentEndCollapsible("collapsible-filter", "d");
        // Workorder listing
        $html = $this->getWorkOrdersList("", false);
        $ui->contentAddHtml($html);
        if ($this->getCountWorkorders() > $system->getPageSize()) {
            $ui->contentAddHtml('<div style="text-align:center;" id="loading_rows">
										<img src="../images/spinner.gif">&nbsp;' . __('Loading...') . '</img>
									</div>');
            $this->addWorkOrdersLoader();
        }
        $ui->endContent();
        // Foooter buttons
        // New
        $button_new = "<a href='index.php?page=workorder' data-role='button'\n\t\t\t\t\t\t\tdata-ajax='false' data-icon='plus'>" . __('New') . "</a>\n";
        // Pagination
        //~ $filter = "";
        //~ if ($this->filter_search != '') {
        //~ $filter .= "&filter_search=".$this->filter_search;
        //~ }
        //~ if ($this->filter_owner != '') {
        //~ $filter .= "&filter_owner=".$this->filter_owner;
        //~ }
        //~ if  ($this->filter_creator != '') {
        //~ $filter .= "&filter_creator=".$this->filter_creator;
        //~ }
        //~ if ($this->filter_status) {
        //~ $filter .= "&filter_status=".$this->filter_status;
        //~ }
        //~ $paginationCG = $ui->getPaginationControgroup("workorders$filter", $this->offset, $this->getNumPages());
        $ui->createFooter($button_new);
        $ui->showFooter();
        $ui->showPage();
    }
Ejemplo n.º 9
0
	public function showWorkUnit ($message = "") {
		$system = System::getInstance();
		$ui = Ui::getInstance();
		
		$ui->createPage();
		
		// Header
		$back_href = "index.php?page=home";
		$right_href = "index.php?page=workunits";
		if ($this->id_workunit < 0) {
			$title = __("Workunit");
		} else {
			$title = __("Workunit")."&nbsp;#".$this->id_workunit;
		}
		$ui->createHeader($title,
			$ui->createHeaderButton(
				array('icon' => 'back',
					'pos' => 'left',
					'text' => __('Back'),
					'href' => $back_href
					)
				),
			$ui->createHeaderButton(
				array('icon' => 'grid',
					'pos' => 'right',
					'text' => __('List'),
					'href' => $right_href
					)
				)
			);
		// Content
		$ui->beginContent();
			
			// Message popup
			if ($message != "") {
				$options = array(
					'popup_id' => 'message_popup',
					'popup_custom' => true,
					'popup_content' => $message
					);
				$ui->addPopup($options);
				$ui->contentAddHtml("<script type=\"text/javascript\">
										$(document).on('pageshow', function() {
											$(\"div.popup-back\")
												.click(function (e) {
													e.preventDefault();
													$(this).remove();
												})
												.show();
										});
									</script>");
			}
			$html = $this->getWorkUnitForm();
			$ui->contentAddHtml($html);
		$ui->endContent();
		// Foooter buttons
		// Add
		if ($this->id_workunit < 0) {
			$button_add = "<a onClick=\"$('#form-workunit').submit();\" data-role='button' data-icon='plus'>"
							.__('Add')."</a>\n";
		} else {
			$button_add = "<a onClick=\"$('#form-workunit').submit();\" data-role='button' data-icon='refresh'>"
							.__('Update')."</a>\n";
		}
		// Delete
		$button_delete = '';
		if ($this->id_workunit > 0) {
			$button_delete = "<a href='index.php?page=workunits&operation=delete_workunit&id_workunit=".$this->id_workunit."' 
									data-role='button' data-ajax='false' data-icon='delete'>".__('Delete')."</a>\n";
		}
		$ui->createFooter("<div data-type='horizontal' data-role='controlgroup'>$button_add"."$button_delete</div>");
		$ui->showFooter();
		$ui->showPage();
	}
Ejemplo n.º 10
0
	public function showLogin() {
		$ui = Ui::getInstance();
		
		$ui->createPage();
		if ($this->errorLogin) {
			
			$options['type'] = 'onStart';
			$options['title_text'] = __('Login Failed');
			$options['content_text'] = __('User not found in database or incorrect password.');
			$ui->addDialog($options);
			
		}
		$logo = "<img src='../images/integria_logo_header.png' style='border:0px;' alt='Home' >";
		$ui->createHeader("<div style='text-align:center;'>$logo</div>", null, null, "logo");
		$ui->showFooter();
		$ui->beginContent();
			
			$ui->beginForm();
			$ui->formAddHtml(print_input_hidden('action', 'login', true));
			$options = array(
				'name' => 'user',
				'value' => $this->user,
				'placeholder' => __('User'),
				'label' => __('User')
				);
			$ui->formAddInputText($options);
			$options = array(
				'name' => 'password',
				'value' => '',
				'placeholder' => __('Password'),
				'label' => __('Password')
				);
			$ui->formAddInputPassword($options);
			$options = array(
				'value' => __('Login'),
				'icon' => 'star',
				'icon_pos' => 'right'
				);
			$ui->formAddSubmitButton($options);
			$ui->endForm();
		$ui->endContent();
		$ui->showPage();
		
		$this->errorLogin = false;
		$this->logout_action = false;
	}
Ejemplo n.º 11
0
    private function showIncident($tab = "view", $message = "")
    {
        $system = System::getInstance();
        $ui = Ui::getInstance();
        $ui->createPage();
        // Header options
        $header_title = __("Ticket") . "&nbsp;#" . $this->id_incident;
        $left_href = "index.php?page=incidents";
        $header_left_button = $ui->createHeaderButton(array('icon' => 'back', 'pos' => 'left', 'text' => __('Back'), 'href' => $left_href));
        $right_href = "index.php?page=home";
        $header_right_button = $ui->createHeaderButton(array('icon' => 'home', 'pos' => 'right', 'text' => __('Home'), 'href' => $right_href));
        // Content
        $selected_tab_detail = "";
        $selected_tab_workunit = "";
        $selected_tab_file = "";
        $ui->beginContent();
        // Message popup
        if ($message != "") {
            $options = array('popup_id' => 'message_popup', 'popup_content' => $message);
            $ui->addPopup($options);
            $ui->contentAddHtml("<script type=\"text/javascript\">\n\t\t\t\t\t\t\t\t\t\t\$(document).on('pageshow', function() {\n\t\t\t\t\t\t\t\t\t\t\t\$(\"#message_popup\").popup(\"open\");\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t</script>");
        }
        switch ($tab) {
            case 'detail':
                $selected_tab_detail = "class=\"ui-btn-active ui-state-persist\"";
                $ui->contentAddHtml($this->getIncidentDetail());
                // Header options
                $right_href = "index.php?page=home";
                // Edit in the future
                $header_right_button = $ui->createHeaderButton(array('icon' => 'home', 'pos' => 'right', 'text' => __('Home'), 'href' => $right_href));
                break;
            case 'edit':
                break;
            case 'workunits':
                $selected_tab_workunit = "class=\"ui-btn-active ui-state-persist\"";
                $workunits = new Workunits();
                $href = "index.php?page=incident&tab=workunit&id_incident=" . $this->id_incident;
                $delete_button = false;
                $delete_href = "";
                // Workunits listing
                $html = $workunits->getWorkUnitsList($href, $delete_button, $delete_href);
                $ui->contentAddHtml($html);
                if ($workunits->getCountWorkUnits() > $system->getPageSize()) {
                    $ui->contentAddHtml('<div style="text-align:center;" id="loading_rows">
												<img src="../images/spinner.gif">&nbsp;' . __('Loading...') . '</img>
											</div>');
                    $workunits->addWorkUnitsLoader($href);
                }
                unset($workunits);
                // Header options
                $right_href = "index.php?page=incident&tab=workunit&id_incident=" . $this->id_incident;
                $header_right_button = $ui->createHeaderButton(array('icon' => 'add', 'pos' => 'right', 'text' => __('New'), 'href' => $right_href));
                break;
            case 'workunit':
                $selected_tab_workunit = "class=\"ui-btn-active ui-state-persist\"";
                $workunit = new Workunit();
                $action = "index.php?page=incident&tab=workunit";
                $ui->contentAddHtml($workunit->getWorkUnitForm($action, "POST"));
                unset($workunit);
                // Header options
                if ($id_workunit = $system->getRequest('id_workunit', false)) {
                    $header_title = __("Workunit") . "&nbsp;#" . $id_workunit;
                } else {
                    $header_title = __("Workunit");
                }
                $right_href = "index.php?page=incident&tab=workunits&id_incident=" . $this->id_incident;
                $header_right_button = $ui->createHeaderButton(array('icon' => 'grid', 'pos' => 'right', 'text' => __('List'), 'href' => $right_href));
                break;
            case 'files':
                $selected_tab_file = "class=\"ui-btn-active ui-state-persist\"";
                $ui->contentAddHtml($this->getFilesList());
                // Header options
                $right_href = "index.php?page=incident&tab=file&id_incident=" . $this->id_incident;
                $header_right_button = $ui->createHeaderButton(array('icon' => 'add', 'pos' => 'right', 'text' => __('New'), 'href' => $right_href));
                break;
            case 'file':
                $selected_tab_file = "class=\"ui-btn-active ui-state-persist\"";
                $ui->contentAddHtml($this->getFileForm());
                // Header options
                $header_title = __("File");
                $right_href = "index.php?page=incident&tab=files&id_incident=" . $this->id_incident;
                $header_right_button = $ui->createHeaderButton(array('icon' => 'grid', 'pos' => 'right', 'text' => __('List'), 'href' => $right_href));
                break;
            default:
                $tab = 'detail';
                $selected_tab_detail = "class=\"ui-btn-active ui-state-persist\"";
                $ui->contentAddHtml($this->getIncidentDetail());
        }
        $ui->endContent();
        // Header
        $ui->createHeader($header_title, $header_left_button, $header_right_button);
        // Navigation bar
        $tab_detail = "<a href='index.php?page=incident&tab=view&id_incident=" . $this->id_incident . "' {$selected_tab_detail} data-role='button' data-icon='info'>" . __('Info') . "</a>\n";
        $tab_workunit = "<a href='index.php?page=incident&tab=workunits&id_incident=" . $this->id_incident . "' {$selected_tab_workunit} data-role='button' data-icon='star'>" . __('Workunit') . "</a>\n";
        $tab_file = "<a href='index.php?page=incident&tab=files&id_incident=" . $this->id_incident . "' {$selected_tab_file} data-role='button' data-icon='plus'>" . __('Files') . "</a>\n";
        $buttons = array($tab_detail, $tab_workunit, $tab_file);
        $ui->addNavBar($buttons);
        $ui->showPage();
    }
	public function help($request, $response)
	{
		$template = $request->template;
		if (false == empty($template))
		{
			$response->_my_template = '/admindoctor/'.$template;
		}
		else
		{
			$this->message('模板不能为空 ', $response, array('forward' => Ui::createUrl('Case,Index')));
		}
	}
 /** 把一个咨询的患者转化成患友会成员 */
 public function newFromCasePatient($request, $response)
 {
     /*{{{*/
     $threadId = $request->case_id;
     $thread = DAL::get()->find('thread', $threadId);
     $patient = $thread->patient;
     $groupId = $request->category_id;
     $space = $thread->space;
     ForumClient::getInstance()->createGroupOneMember($space, $thread->user, $thread->patient->id, $groupId);
     $defaultGroupId = ForumClient::getInstance()->defaultGroupMember($space->id);
     ForumClient::getInstance()->createGroupOneMember($space, $thread->user, $thread->patient->id, $defaultGroupId);
     //创建至默认组
     $group = DAL::get()->find('ReGroup', $groupId);
     //发站内信
     $msgContent = $thread->user->name . ",您好!<br/>" . $thread->space->name . "大夫已经邀请您参加患友会!<br/>建议您在疾病治疗过程中,多跟病友交流,分享经验!<br/>点这儿,<a href=" . $thread->space->getResidentEvilUrl() . " target='_blank'>去大夫患友会</a> >> ";
     StationLetterClient::getInstance()->sendMsg(Message::AdminUserId, $thread->user->id, Box::RESIDENTEVIL_TITLE, $msgContent, array('relationShip' => $group));
     $this->message('患者 ' . $patient->name . ' 已经移动到患友会 ' . $group->name . ' 分组!', $response, array('text' => '返回问题', 'url' => Ui::createUrl('Case,Detail', array('case_id' => $thread->id))));
 }
Ejemplo n.º 14
0
 public function home()
 {
     $links = array('pages/welcome' => 'Enter');
     $nav = Ui::navigation($links);
     require_once 'views/pages/home.php';
 }