예제 #1
0
파일: crud.php 프로젝트: dezvell/skeleton
<?php

/**
 * Example of Crud Controller
 *
 * @author   Anton Shevchuk
 * @created  04.09.12 11:21
 */
namespace Application;

use Application\Test;
use Bluz\Controller;
/**
 * @accept HTML
 * @accept JSON
 */
return function () {
    $crudController = new Controller\Crud();
    $crudController->setCrud(Test\Crud::getInstance());
    return $crudController();
};
예제 #2
0
<?php

/**
 * Created by PhpStorm.
 * User: gunko
 * Date: 9/11/15
 * Time: 5:33 PM
 */
/**
 * @namespace
 */
namespace Application;

use Application\Media;
use Bluz\Controller;
use Bluz\Proxy\Config;
use Bluz\Proxy\Layout;
use Bluz\Proxy\Session;
use Bluz\Request\AbstractRequest;
return function () {
    $crud = Musician\Crud::getInstance();
    $path = Config::getModuleData('musician', 'upload_path');
    if (empty($path)) {
        throw new Exception('Upload_path is not configured');
    }
    $crud->setUploadDir($path . "/musician");
    $crudController = new Controller\Crud();
    $crudController->setCrud(Musician\Crud::getInstance());
    return $crudController();
};
예제 #3
0
use Bluz\Proxy\Request;
use Bluz\Proxy\Config;
use Bluz\Proxy\Session;
/**
 *@SWG\Resource(resourcePath="/upload")
 * @SWG\API(
 *  path = "/api/upload/",
 *  @SWG\Operation(
 *      method = "POST",
 *      nickname = "Upload image",
 *      summary = "Upload images",
 *      @SWG\Parameter(
 *          name = "files",
 *          paramType = "form",
 *          consumes = "multipart/form-data",
 *          description = "Upload images",
 *          required = true,
 *          type="File"
 *      ),
 *      @SWG\ResponseMessage(code=400, message="Invalid file type"),
 *      @SWG\ResponseMessage(code=200, message="File was uploaded")
 *  )
 * )
 */
return function () {
    $this->useJson();
    $crudController = new Controller\Crud();
    $crudController->setCrud(Menu\FileCrud::getInstance());
    $fileObjects = $crudController();
    return $fileObjects;
};
예제 #4
0
파일: crud.php 프로젝트: dezvell/skeleton
<?php

/**
 * @author   Anton Shevchuk
 * @created  30.10.12 09:29
 */
namespace Application;

use Application\Users;
use Bluz\Controller;
return function () {
    /**
     * @var Bootstrap $this
     */
    $crudController = new Controller\Crud();
    $crudController->setCrud(Users\Crud::getInstance());
    return $crudController();
};
예제 #5
0
파일: crud.php 프로젝트: dezvell/skeleton
<?php

/**
 * @author   Viacheslav Nogin
 * @created  25.11.12 09:29
 */
/**
 * @namespace
 */
namespace Application;

use Application\Categories;
use Bluz\Controller;
return function ($parentId = null) use($view) {
    /**
     * @var Bootstrap $this
     */
    $view->parentId = $parentId;
    $crudController = new Controller\Crud();
    $crudController->setCrud(Categories\Crud::getInstance());
    return $crudController();
};
예제 #6
0
 /**
  * Process Crud
  *
  * @return mixed
  */
 protected function processCrud()
 {
     $crudController = new Controller\Crud();
     $crudController->setCrud(Crud::getInstance());
     return $crudController();
 }
예제 #7
0
파일: roles.php 프로젝트: dezvell/skeleton
<?php

/**
 * @author   Anton Shevchuk
 * @created  04.09.12 11:21
 */
/**
 * @namespace
 */
namespace Application;

use Application\Roles;
use Bluz\Controller;
return function () {
    /**
     * @var Bootstrap $this
     */
    $crudController = new Controller\Crud();
    $crudController->setCrud(Roles\Crud::getInstance());
    return $crudController();
};
예제 #8
0
파일: crud.php 프로젝트: dezvell/skeleton
<?php

/**
 * CRUD for options
 */
/**
 * @namespace
 */
namespace Application;

use Application\Options;
use Bluz\Controller;
return function () {
    /**
     * @var Bootstrap $this
     */
    $crudController = new Controller\Crud();
    $crudController->setCrud(Options\Crud::getInstance());
    return $crudController();
};
예제 #9
0
파일: crud.php 프로젝트: dezvell/skeleton
use Bluz\Proxy\Session;
use Bluz\Request\AbstractRequest;
return function () use($view) {
    /**
     * @var Bootstrap $this
     * @var \Bluz\View\View $view
     */
    Session::start();
    $this->useLayout('dashboard.phtml');
    Layout::breadCrumbs([$view->ahref('Dashboard', ['dashboard', 'index']), $view->ahref('Media', ['media', 'grid']), __('Upload')]);
    if (!$this->user()) {
        throw new Exception('User not found');
    }
    $userId = $this->user()->id;
    $crud = Media\Crud::getInstance();
    // get path from config
    $path = Config::getModuleData('media', 'upload_path');
    if (empty($path)) {
        throw new Exception('Upload path is not configured');
    }
    $crud->setUploadDir($path . '/' . $userId . '/media');
    $crudController = new Controller\Crud();
    $crudController->setCrud($crud);
    $result = $crudController();
    // FIXME: workaround
    if (($crudController->getMethod() == AbstractRequest::METHOD_POST or $crudController->getMethod() == AbstractRequest::METHOD_PUT) && !$result) {
        // all ok, go to grid
        $this->redirectTo('media', 'grid');
    }
    return $result;
};