예제 #1
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;
 }
예제 #2
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();
 }
예제 #3
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();
    }
예제 #4
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();
	}
예제 #5
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;
	}
예제 #6
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();
	}
예제 #7
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();
    }
예제 #8
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;
	}
예제 #9
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();
    }