示例#1
0
 /**
  * funkce smaze kategorii
  * @param int $category_id
  * @return bool
  */
 public function deleteCategory($category_id)
 {
     try {
         return Categories::deleteCategory($category_id);
     } catch (Exception $e) {
         throw new RPCFault($e->getMessage(), $e->getCode(), $e->getCode());
     }
 }
         $c->addCategory($data);
         if ($data && $data['id'] != '') {
             $message = 'Category was successfully updated.';
         } else {
             $message = 'New category has been added.';
         }
         $app->flash('success', $message);
         $app->redirect(ADMIN_MANAGE . '/categories');
     });
     $app->get('(/(:id(/:action)))', 'validateUser', function ($id = null, $action = null) use($app) {
         $category = null;
         $c = new Categories($id);
         if ($id && $action == 'edit') {
             $category = $c->findCategory();
         } elseif ($id && $action == 'delete') {
             if ($c->deleteCategory()) {
                 $app->flash('success', 'Category has been deleted.');
             } else {
                 $app->flash('danger', 'Category could not be deleted as there are jobs associated with it.');
             }
             $app->redirect(ADMIN_MANAGE . '/categories');
         }
         $categories = Categories::findCategories();
         $app->render(ADMIN_THEME . 'categories.edit.php', array('categs' => $categories, 'category' => $category));
     });
 });
 /*
  * Manage cities group
  */
 $app->group('/cities', function () use($app) {
     $app->post('/', 'isValidReferrer', 'validateUser', function () use($app) {