コード例 #1
0
 private function getCatParent()
 {
     $rCat = new WsAreaCategory();
     $rCat->setCategory_id($this->Data['category_id']);
     $rCat->Execute()->find();
     if ($rCat->Execute()->getResult()) {
         return $rCat->Execute()->getResult()->category_parent;
     } else {
         return null;
     }
 }
コード例 #2
0
ファイル: update.php プロジェクト: adrianosilvareis/intranet
            <div class="label_line">

                <label class="label_small">
                    <span class="field">Data:</span>
                    <input type="text" class="formTimestamp center" name="category_date" value="<?php 
echo date('d/m/Y H:i:s');
?>
" />
                </label>

                <label class="label_small left">
                    <span class="field">Seção:</span>
                    <select name="category_parent">
                        <option value="null"> Selecione a Seção: </option>
                        <?php 
$ReadSet = new WsAreaCategory();
$ReadSet->Execute()->Query("category_parent is NULL ORDER BY category_title ASC");
if (!$ReadSet->Execute()->getResult()) {
    echo '<option disabled="disable" value="null"> Cadastre antes uma seção! </option>';
} else {
    foreach ($ReadSet->Execute()->getResult() as $ses) {
        echo "<option value=\"{$ses->category_id}\" ";
        if ($ses->category_id == $data['category_parent']) {
            echo ' selected="seleted" ';
        }
        echo "> {$ses->category_title} </option>";
    }
}
?>
                    </select>
                </label>
コード例 #3
0
 /**
  * Encontra o Id da area a partir da descrição.
  * @param string $TypeName
  * @return int
  */
 public static function AreaTypeByName($TypeName)
 {
     $Read = new WsAreaCategory();
     $Read->setCategory_title($TypeName);
     $query = $Read->Execute()->Query("#category_title#");
     if ($Read->Execute()->getResult()) {
         return (int) $query[0]->category_id;
     } else {
         WSErro("O tipo de área <b>{$TypeName}</b> não foi encontrado!", WS_ERROR);
         return null;
     }
 }
コード例 #4
0
ファイル: index.php プロジェクト: adrianosilvareis/intranet
        
        <h1>Categorias:</h1>

        <?php 
$empty = filter_input(INPUT_GET, 'empty', FILTER_VALIDATE_BOOLEAN);
if ($empty) {
    WSErro("Você tentou editar uma categoria que não existe no sistema!", WS_INFOR);
}
$delCat = filter_input(INPUT_GET, 'delete', FILTER_VALIDATE_INT);
if ($delCat) {
    require '_models/AdminAreaCategory.class.php';
    $deletar = new AdminAreaCategory();
    $deletar->ExeDelete($delCat);
    WSErro($deletar->getError()[0], $deletar->getError()[1]);
}
$ReadSes = new WsAreaCategory();
$ReadSes->Execute()->Query("category_parent IS NULL ORDER BY category_title ASC");
if (!$ReadSes->Execute()->getResult()) {
    WSErro("Desculpa, ainda não temos categorias cadastrados", WS_INFOR);
} else {
    foreach ($ReadSes->Execute()->getResult() as $ses) {
        extract((array) $ses);
        $ReadSes->setCategory_parent($category_id);
        $ReadSes->Execute()->Query("#category_parent#");
        $ContSesCats = $ReadSes->Execute()->getRowCount();
        ?>
                <section>

                    <header>
                        <h1><?php 
        echo $category_title;
コード例 #5
0
ファイル: update.php プロジェクト: adrianosilvareis/intranet
echo isset($data['area_date']) ? date('d/m/Y H:i:s', strtotime($data['area_date'])) : date('d/m/Y H:i:s');
?>
" />
                </label>

                <label class="label_small">
                    <span class="field">Categoria:</span>
                    <select name="category_id">
                        <option value=""> Selecione a categoria: </option>
                        <?php 
$ReadSes = new WsAreaCategory();
$ReadSes->Execute()->Query("category_parent IS NULL ORDER BY category_title ASC");
if ($ReadSes->Execute()->getRowCount() >= 1) {
    foreach ($ReadSes->Execute()->getResult() as $ses) {
        echo "<option disabled=\"disabled\" value=\"\"> {$ses->category_title} </option>";
        $ReadSet = new WsAreaCategory();
        $ReadSet->setCategory_parent($ses->category_id);
        $ReadSet->Execute()->Query("#category_parent# ORDER BY category_title ASC");
        if ($ReadSet->Execute()->getRowCount() >= 1) {
            foreach ($ReadSet->Execute()->getResult() as $cat) {
                echo "<option ";
                if ($data['category_id'] == $cat->category_id) {
                    echo "selected=\"selected\" ";
                }
                echo "value=\"{$cat->category_id}\"> &raquo;&raquo;{$cat->category_title} </option>";
            }
        }
    }
}
?>
                    </select>
コード例 #6
0
 private function checkCats()
 {
     $Read = new WsAreaCategory();
     $Read->setCategory_parent($this->CatId);
     $Read->Execute()->Query("#category_parent#");
     if (!empty($Read->Execute()->getResult()[0])) {
         return false;
     } else {
         return true;
     }
 }