예제 #1
0
 }
 $result = Rsys::get_num_subscriptions_ReservationPeriods($Reservation_id);
 if ($result != '0') {
     $interbreadcrumb[] = array("url" => "mysubscriptions.php", "name" => get_lang('Booking'));
     $interbreadcrumb[] = array("url" => "m_reservation.php", "name" => get_lang('ManageBookingPeriods'));
     Display::display_header('');
     api_display_tool_title($tool_name);
     Display::display_normal_message(Rsys::get_return_msg(str_replace('#NUM#', $result, get_lang('BookingPeriodHasSubscriptions')), "m_reservation.php", get_lang('BookingPeriodList')), false);
 } else {
     $interbreadcrumb[] = array("url" => "mysubscriptions.php", "name" => get_lang('Booking'));
     $interbreadcrumb[] = array("url" => "m_reservation.php", "name" => get_lang('ManageBookingPeriods'));
     Display::display_header(get_lang('EditBookingPeriod'));
     api_display_tool_title(get_lang('EditNewBookingPeriod'));
     $reservation = Rsys::get_reservation($Reservation_id);
     $item_category = Rsys::get_item($reservation[0][2]);
     $categori = Rsys::get_category($item_category[1]);
     $cats = Rsys::get_category_rights();
     $tijdelijke_cat = $categori[0];
     if (isset($_GET['cat_id'])) {
         $categori[0] = $_GET['cat_id'];
     }
     ob_start();
     echo '<form id="cat_form" action="m_reservation.php" method="get">';
     echo '<input type="hidden" name="id" value="' . $Reservation_id . '" />';
     echo '<input type="hidden" name="action" value="edit"/>';
     echo '<div class="row">';
     echo '<div class="label">' . get_lang('ResourceType') . ': </div>';
     echo '<div class="formw">';
     echo '<select name="cat_id" onchange="this.form.submit();">';
     echo '<option value="0">&nbsp;</option>';
     foreach ($cats as $catid => $cat) {
     //$form->addRule('course', get_lang('ThisFieldIsRequired'), 'required');
     $form->addElement('submit', 'submit', get_lang('Ok'));
     if ($form->validate()) {
         $values = $form->exportValues();
         if (Rsys::add_item($values['name'], $values['description'], $values['category'], $values['course_code'])) {
             Display::display_normal_message(Rsys::get_return_msg(get_lang('ItemAdded'), "m_item.php", $tool_name), false);
         } else {
             Display::display_normal_message(Rsys::get_return_msg(get_lang('ItemExist'), "m_item.php?action=add", get_lang('AddNewItem')), false);
         }
     } else {
         $form->display();
     }
     break;
 case 'edit':
     $item = Rsys::get_item($_GET['id']);
     $cats = Rsys::get_category();
     foreach ($cats as $cat) {
         $catOptions[$cat['id']] = $cat['name'];
     }
     $interbreadcrumb[] = array("url" => "m_item.php", "name" => $tool_name);
     Display::display_header(str_replace('#ITEM#', $item['name'], get_lang('EditItem')));
     api_display_tool_title(get_lang('EditItem2'));
     $form = new FormValidator('item', 'post', 'm_item.php?action=edit');
     $form->addElement('select', 'category_id', get_lang('Category'), $catOptions);
     $form->add_textfield('name', get_lang('ItemName'), array('maxlength' => '128'));
     $form->addElement('textarea', 'description', get_lang('ItemDescription'), array('rows' => '3', 'cols' => '40'));
     $form->addRule('category_id', get_lang('ThisFieldIsRequired'), 'required');
     $form->addElement('hidden', 'id', $item['id']);
     $form->addElement('submit', 'submit', get_lang('Ok'));
     $form->setDefaults($item);
     if ($form->validate()) {
예제 #3
0
			if (Rsys :: add_category($values['name']))
				Display :: display_normal_message(Rsys :: get_return_msg(get_lang('ResourceTypeAdded'), "m_category.php", $tool_name),false);
			else
				Display :: display_normal_message(Rsys :: get_return_msg(get_lang('ResourceTypeExist'), "m_category.php?action=add", get_lang('AddNewResourceType')),false);
		} else
			$form->display();
		break;
	case 'edit' :
		$interbreadcrumb[] = array ("url" => "m_category.php", "name" => $tool_name);
		Display :: display_header(get_lang('EditResourceType'));
		api_display_tool_title(get_lang('EditResourceType'));
		$form = new FormValidator('category', 'post', 'm_category.php?action=edit');
		$form->add_textfield('name', get_lang('ResourceTypeName'), true, array ('maxlength' => '128'));
		$form->addElement('hidden', 'id', intval($_GET['id']));
		$form->addElement('style_submit_button', 'submit', get_lang('ModifyResourceType'),'class="save"');
		$form->setDefaults(Rsys :: get_category($_GET['id']));
		if ($form->validate()) {
			$values = $form->exportValues();
			if (Rsys :: edit_category($values['id'], $values['name']))
				Display :: display_normal_message(Rsys :: get_return_msg(get_lang('ResourceTypeEdited'), "m_category.php", $tool_name),false);
			else
				Display :: display_normal_message(Rsys :: get_return_msg(get_lang('ResourceTypeExist'), "m_category.php?action=edit&id=".$values['id'], get_lang('EditRight')),false);
		} else
			$form->display();
		break;
	case 'delete' :
		$result = Rsys :: delete_category($_GET['id']);
		ob_start();
		if ($result == 0)
			Display :: display_normal_message(get_lang('ResourceTypeDeleted'),false);
		else