Пример #1
0
 function action_Remove()
 {
     PermissionHelper::Verification('Editor');
     $section_id = $_GET['id'];
     $section = SectionService::GetById($section_id);
     CatalogueService::Delete($section);
     header("Location: /section/item");
 }
 function action_Update()
 {
     PermissionHelper::Verification('Editor');
     $group_id = $_POST['id'];
     $group_name = $_POST['inputName'];
     $group = SectionService::GetById($group_id);
     $group->name = $group_name;
     AttributeGroupService::Save($group);
     header("Location: /AttributeGroup/Item");
 }
Пример #3
0
 function action_new()
 {
     PermissionHelper::Verification('Editor');
     $name = $_POST['inputName'];
     $sectionName = $_POST['inputSection'];
     $attribute = $_POST['attributes'];
     $catalogue = new Catalogue();
     $catalogue->name = $name;
     $catalogue->section_id = SectionService::GetByName($sectionName)->section_id;
     CatalogueService::Create($catalogue);
     $catalogue = CatalogueService::GetByName($name);
     for ($i = 0; $i < count($attribute); $i++) {
         $value = new CatalogueAttribute();
         $value->catalogue_id = $catalogue->catalogue_id;
         $value->attribute_id = AttributeService::GetByName(trim($attribute[$i]))->attribute_id;
         CatalogueAttributeService::Create($value);
     }
     header("Location: /Catalog/Item");
 }
Пример #4
0
<?php

require_once ykfile("source/section_service.php");
$params = json_decode(file_get_contents('php://input'));
$sectSer = new SectionService();
$result = $sectSer->save_video($params);
if ($result) {
    echo json_encode(array("status" => 0, "message" => "保存完成"));
} else {
    echo json_encode(array("status" => 1, "message" => "保存失败"));
}
Пример #5
0
<?php

require_once 'php-activerecord/ActiveRecord.php';
ActiveRecord\Config::initialize(function ($cfg) {
    $cfg->set_model_directory(__DIR__ . '/models');
    $cfg->set_connections(array('development' => 'mysql://root:@127.0.0.1/Store'));
});
require_once 'core/model.php';
require_once 'core/view.php';
require_once 'core/controller.php';
require_once 'core/route.php';
define('__ROOT__', $_SERVER['DOCUMENT_ROOT']);
define('__CanCreate__', 0x1);
define('__CanRead__', 0x2);
define('__CanUpdate__', 0x4);
define('__CanRemove__ ', 0x8);
define('__Cancel__', 2);
define('__WaitConfirm__', 1);
define('__AwaitingDelivery__', 3);
define('__Access__ ', 4);
define('__Received__ ', 5);
define('__Viewer__', "Viewer");
define('__Editor __ ', "Editor");
require_once __ROOT__ . '/application/Helper/PermissionHelper.php';
require_once __ROOT__ . '/application/Helper/SectionHelper.php';
require_once __ROOT__ . '/application/Service/SectionService.php';
$sections = SectionHelper::PopulateSectionViewModelList(SectionService::GetAll());
Route::start();