public function save(NewRSS $news)
 {
     if (SessionAdmin::isLogged()) {
         $this->dao->save($news);
     } else {
         throw new LoginException();
     }
 }
 public function delete($id)
 {
     if (SessionAdmin::isLogged()) {
         return $this->dao->delete($id);
     } else {
         throw new LoginException();
     }
 }
 public static function restAdmin()
 {
     self::initRequests();
     if (strpos(self::link(), "?") !== false) {
         $link = substr(self::link(), 0, strpos(self::link(), "?"));
     } else {
         $link = self::link();
     }
     $link = self::restCountryEdition($link);
     $link = self::restDataEdition($link);
     if (SessionAdmin::isLogged() || $link == 'login' || isset($_REQUEST['no-must-online'])) {
         if (self::$map_requests->containsKey($link)) {
             if (file_exists(self::$map_requests->get($link))) {
                 //throw new FileNotFoundException(SessionAdmin::isLogged().'-'.SessionAdmin::getAdminName());
                 //return self::$map_requests->get($link);
                 return self::$map_requests->get($link);
             }
             throw new FileNotFoundException("Arquivo de requisição não encontrado!");
         }
         throw new Exception("Destino não encontrado!");
     } else {
         throw new LoginException();
     }
 }
 public function saveValues(ExcelInputFile $excelInputFile, $subgroup, $font, $origin, $destiny, $coffeType, $variety, $typeCountry = null, $internationalTrade = false)
 {
     if (SessionAdmin::isLogged()) {
         CacheCountry::setCacheBehavior(SessionAdmin::getCacheBehavior());
         try {
             if (!is_null($typeCountry)) {
                 $countries = $excelInputFile->getValuesOfColumn(1);
                 $wrongSelected = $this->countriesSelectedAreCorrect($typeCountry, $countries);
                 if (sizeof($wrongSelected) > 0) {
                     $nameOfWrongCountries = $this->countriesAsString($wrongSelected);
                     $message = "- Os seguintes países presentes na planilha (" . utf8_encode($nameOfWrongCountries) . ") não correspondem ao grupo que você selecionou.";
                     $message .= "\n\n";
                     $message .= "\t- Confirme se os países existem na lista (origem ou destino) que você selecionou;";
                     $message .= "\n\n";
                     $message .= "\t- Verifique se falta acentuação no nome do país da planinha selecionada.";
                     $message .= "\n\n";
                     $message .= "\t- Também certifique-se de que os nomes dos países estejam em português e sem abreviações";
                     throw new WrongFormatException($message);
                 }
             }
             if ($this->datacenterService->insertValues($excelInputFile, $subgroup, $origin, $destiny, $coffeType, $variety, $font, $typeCountry, $internationalTrade)) {
                 return $this->jsonResponse->response(true, "Dados inseridos com sucesso!")->serialize();
             } else {
                 $message = "Dados não inseridos. Verifique a possibilidade de já existirem dados referentes a esta planilha";
                 return $this->jsonResponse->response(true, $message)->serialize();
             }
         } catch (Exception $e) {
             return $this->jsonResponse->response(false, $e->getMessage())->serialize();
         }
     } else {
         throw new LoginException();
     }
 }
Exemple #5
0
        <!--<script type="text/javascript" src="<?echo $baseUrl?>/assets/js/jquery.min.js"></script>-->
        <script type="text/javascript" src="<?echo $baseUrl?>/assets/js/jquery-1.6.2.min.js"></script>
        <!--<script type="text/javascript" src="<?echo $baseUrl?>/assets/js/jquery-ui-1.8.8.custom.min.js"></script>-->
        <script type="text/javascript" src="<?echo $baseUrl?>/assets/js/jquery-ui-1.8.15.custom.min.js"></script>
        <script type="text/javascript" src="<?echo $baseUrl?>/assets/js/jquery.form.js"></script>
        <script type="text/javascript" src="<?echo $baseUrl?>/assets/js/jquery.cooquery.js"></script>
        <script type="text/javascript" src="<?echo $baseUrl?>/assets/js/jquery.cycle.min.js"></script>
        <script type="text/javascript" src="<?echo $baseUrl?>/assets/js/events_admin.js"></script>
        <script type="text/javascript" src="<?echo $baseUrl?>/assets/js/admin_ajax.js"></script>
        <script type="text/javascript" src="<?echo $baseUrl?>/assets/js/admin.js"></script>
        <!--<script type="text/javascript" src="<?echo $baseUrl?>/admin/View/tinymce/jscripts/tiny_mce/tiny_mce_gzip.js"></script>-->
        <script type="text/javascript" src="<?echo $baseUrl?>/admin/View/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
    </head>
    <body>
        <div class="container_12">
            <?if(SessionAdmin::isLogged()):?>
            <div class="user-header">
                <span class="adminlogged-name"><?echo SessionAdmin::getAdminName()?></span>
                <span><a href="<?echo LinkController::getBaseURL()?>/admin/logoutAdmin">sair</a></span>
            </div>
            <?endif?>

            <h1 style="width: 100%" class="titleadmin">Administrador Bureau Inteligência</h1>
            <div class="grid_12 menu-apps">
                <ul>
                    <li><a href="<?echo $baseUrl?>/admin/publicacoes" id="lnk-publicacoes">Publica&ccedil;&otilde;es</a></li>
                    <li><a href="<?echo $baseUrl?>/admin/noticias" id="lnk-noticias">Not&iacute;cias</a></li>
                    <li><a href="" id="lnk-cotacoes">Cota&ccedil;&otilde;es</a></li>
                    <li><a href="<?echo $baseUrl?>/admin/videos" id="lnk-videoteca">Videoteca</a></li>
                    <li><a href="" id="lnk-metereologia">Meteorologia</a></li>
                    <li class="ultimo"><a href="<?echo $baseUrl?>/admin/datacenter" id="lnk-datacenter">Data Center</a></li>