Exemple #1
0
        foreach ($check as $item) {
            $retorno = $DAO->DeletarRelacionamento($item);
            if ($retorno != 1) {
                break;
            }
        }
        if ($retorno == 1) {
            echo '<script language= "JavaScript">alert("Registro removido com sucesso");</script>';
            echo '<script language= "JavaScript">location.href="rel_pessoal.php?id=' . $id . '";</script>';
        } else {
            echo '<script language= "JavaScript">alert("Erro ao excluir");</script>';
        }
    }
}
if (!empty($_GET['cmd']) && $_GET['cmd'] == 'del') {
    $item = ValidateInteger(INPUT_GET, 'item');
    $id = $_GET['id'];
    $retorno = $DAO->DeletarRelacionamento($item);
    if ($retorno == 1) {
        echo '<script language= "JavaScript">alert("Registro removido com sucesso");</script>';
        echo '<script language= "JavaScript">location.href="rel_pessoal.php?id=' . $id . '";</script>';
    } else {
        echo '<script language= "JavaScript">alert("Erro ao excluir");</script>';
    }
}
?>

<script>
function marcarTodos(marcar){
    var itens = document.getElementsByName('check[]');
Exemple #2
0
<?php

include_once '../../includes.sys/ini.php';
include_once '../../includes.sys/metodos.php';
include_once '../DAO/EquipamentoDAO.php';
checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true');
include_once '../../head.php';
if (!in_array(295, listarAcesso())) {
    echo '<script language= "JavaScript">location.href="index.php";</script>';
}
$DAO = new EquipamentoDAO();
if (!empty($_GET['cmd']) && $_GET['cmd'] == 'del') {
    $id = ValidateInteger(INPUT_GET, 'id');
    $retorno = $DAO->Deletar($id);
    if ($retorno == 1) {
        echo '<script language= "JavaScript">alert("Registro removido com sucesso");</script>';
        echo '<script language= "JavaScript">location.href="index.php";</script>';
    } else {
        echo '<script language= "JavaScript">alert("Erro ao remover o registro");</script>';
    }
}
?>
	<!-- topbar ends -->
		<div class="container-fluid">
		<div class="row-fluid">
				
			<!-- left menu starts -->
			<div class="span2 main-menu-span">
				<?php 
include_once '../menu.php';
?>
 protected function _AddEdit($Sender, $PocketID = FALSE)
 {
     $Form = new Gdn_Form();
     $PocketModel = new Gdn_Model('Pocket');
     $Form->SetModel($PocketModel);
     $Sender->ConditionModule = new ConditionModule($Sender);
     $Sender->Form = $Form;
     if ($Form->AuthenticatedPostBack()) {
         // Save the pocket.
         if ($PocketID !== FALSE) {
             $Form->SetFormValue('PocketID', $PocketID);
         }
         // Convert the form data into a format digestable by the database.
         $Repeat = $Form->GetFormValue('RepeatType');
         switch ($Repeat) {
             case Pocket::REPEAT_EVERY:
                 $PocketModel->Validation->ApplyRule('EveryFrequency', 'Integer');
                 $PocketModel->Validation->ApplyRule('EveryBegin', 'Integer');
                 $Frequency = $Form->GetFormValue('EveryFrequency', 1);
                 if (!$Frequency || !ValidateInteger($Frequency) || $Frequency < 1) {
                     $Frequency = 1;
                 }
                 $Repeat .= ' ' . $Frequency;
                 if ($Form->GetFormValue('EveryBegin', 1) > 1) {
                     $Repeat .= ',' . $Form->GetFormValue('EveryBegin');
                 }
                 break;
             case Pocket::REPEAT_INDEX:
                 $PocketModel->Validation->AddRule('IntegerArray', 'function:ValidateIntegerArray');
                 $PocketModel->Validation->ApplyRule('Indexes', 'IntegerArray');
                 $Indexes = explode(',', $Form->GetFormValue('Indexes', ''));
                 $Indexes = array_map('trim', $Indexes);
                 $Repeat .= ' ' . implode(',', $Indexes);
                 break;
             default:
                 break;
         }
         $Form->SetFormValue('Repeat', $Repeat);
         $Form->SetFormValue('Sort', 0);
         $Form->SetFormValue('Format', 'Raw');
         $Condition = Gdn_Condition::ToString($Sender->ConditionModule->Conditions(TRUE));
         $Form->SetFormValue('Condition', $Condition);
         if ($Form->GetFormValue('Ad', 0)) {
             $Form->SetFormValue('Type', Pocket::TYPE_AD);
         } else {
             $Form->SetFormValue('Type', Pocket::TYPE_DEFAULT);
         }
         $Saved = $Form->Save();
         if ($Saved) {
             $Sender->StatusMessage = T('Your changes have been saved.');
             $Sender->RedirectUrl = Url('settings/pockets');
         }
     } else {
         if ($PocketID !== FALSE) {
             // Load the pocket.
             $Pocket = $PocketModel->GetWhere(array('PocketID' => $PocketID))->FirstRow(DATASET_TYPE_ARRAY);
             if (!$Pocket) {
                 return Gdn::Dispatcher()->Dispatch('Default404');
             }
             // Convert some of the pocket data into a format digestable by the form.
             list($RepeatType, $RepeatFrequency) = Pocket::ParseRepeat($Pocket['Repeat']);
             $Pocket['RepeatType'] = $RepeatType;
             $Pocket['EveryFrequency'] = GetValue(0, $RepeatFrequency, 1);
             $Pocket['EveryBegin'] = GetValue(1, $RepeatFrequency, 1);
             $Pocket['Indexes'] = implode(',', $RepeatFrequency);
             $Pocket['Ad'] = $Pocket['Type'] == Pocket::TYPE_AD;
             $Sender->ConditionModule->Conditions(Gdn_Condition::FromString($Pocket['Condition']));
             $Form->SetData($Pocket);
         } else {
             // Default the repeat.
             $Form->SetFormValue('RepeatType', Pocket::REPEAT_ONCE);
         }
     }
     $Sender->Form = $Form;
     $Sender->SetData('Locations', $this->Locations);
     $Sender->SetData('LocationsArray', $this->GetLocationsArray());
     $Sender->SetData('Pages', array('' => '(' . T('All') . ')', 'activity' => 'activity', 'comments' => 'comments', 'dashboard' => 'dashboard', 'discussions' => 'discussions', 'inbox' => 'inbox', 'profile' => 'profile'));
     return $Sender->Render('AddEdit', '', 'plugins/Pockets');
 }