本文整理汇总了PHP中ActionResponse类的典型用法代码示例。如果您正苦于以下问题:PHP ActionResponse类的具体用法?PHP ActionResponse怎么用?PHP ActionResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ActionResponse类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: save
private function save(ProductFile $productFile)
{
$response = new ActionResponse();
$response->setHeader("Cache-Control", "no-cache, must-revalidate");
$response->setHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT");
$validator = $this->buildValidator((int) $this->request->get('ID'));
if ($validator->isValid()) {
foreach ($this->application->getLanguageArray(true) as $lang) {
if ($this->request->isValueSet('title_' . $lang)) {
$productFile->setValueByLang('title', $lang, $this->request->get('title_' . $lang));
}
if ($this->request->isValueSet('description_' . $lang)) {
$productFile->setValueByLang('description', $lang, $this->request->get('description_' . $lang));
}
}
// Use title as description if no description was provided
$defaultLang = $this->application->getDefaultLanguageCode();
if (!$this->request->isValueSet('description_' . $defaultLang) || $this->request->get('description_' . $defaultLang) == '') {
$productFile->setValueByLang('description', $defaultLang, $this->request->get('title_' . $defaultLang));
}
$productFile->allowDownloadDays->set((int) $this->request->get('allowDownloadDays'));
$productFile->allowDownloadCount->set((int) $this->request->get('allowDownloadCount'));
$productFile->isEmbedded->set($this->request->get('isEmbedded') != false);
$productFile->isPublic->set($this->request->get('isPublic') != false);
$productFile->save();
$response->set('status', 'success');
$response->set('productFile', $productFile->toArray());
} else {
$response->set('status', 'failure');
$response->set('errors', $validator->getErrorList());
}
return $response;
}
开发者ID:saiber,项目名称:www,代码行数:33,代码来源:ProductFileController.php
示例2: update
/**
* Handles LiveCart update process
*/
public function update()
{
$dir = ClassLoader::getRealPath('update') . '/' . $this->getCurrentVersion();
if (!is_dir($dir)) {
return new RawResponse('Update directory not found');
}
$progress = array();
$errors = array();
// load SQL dump file
$sql = $dir . '/update.sql';
if (file_exists($sql)) {
try {
Installer::loadDatabaseDump(file_get_contents($sql), true, $this->request->get('force'));
$progress['sql'] = true;
} catch (Exception $e) {
$errors['sql'] = $e->getMessage();
}
}
$this->application->getConfigContainer()->clearCache();
// execute custom update code
$code = $dir . '/custom.php';
if (file_exists($code)) {
ob_start();
if (!(include $code)) {
$errors['code'] = ob_get_contents();
} else {
$progress['code'] = true;
}
ob_end_clean();
}
$response = new ActionResponse();
$response->set('progress', $progress);
$response->set('errors', $errors);
return $response;
}
开发者ID:saiber,项目名称:www,代码行数:38,代码来源:UpdateController.php
示例3: index
public function index()
{
$this->loadLanguageFile('User');
$response = new ActionResponse('email', $this->request->get('email'));
$response->setHeader('NeedLogin', 1);
return $response;
}
开发者ID:saiber,项目名称:www,代码行数:7,代码来源:SessionController.php
示例4: edit
/**
* Individual settings section
*/
public function edit()
{
$this->config->updateSettings();
$defLang = $this->application->getDefaultLanguageCode();
$languages = $this->application->getLanguageArray(LiveCart::INCLUDE_DEFAULT);
$sectionId = $this->request->get('id');
$values = $this->config->getSettingsBySection($sectionId);
$validation = $this->getValidationRules($values);
$form = $this->getForm($values, $validation);
$types = $multiLingualValues = array();
if (!$values) {
return new RawResponse();
}
foreach ($values as $key => $value) {
if ($this->config->isMultiLingual($key) && 'string' == $value['type'] || 'longtext' == $value['type']) {
foreach ($languages as $lang) {
$form->set($key . ($lang != $defLang ? '_' . $lang : ''), $this->config->getValueByLang($key, $lang));
}
$multiLingualValues[$key] = true;
} else {
$form->set($key, $this->config->get($key));
}
$types[$key] = $value['type'];
}
$response = new ActionResponse();
$response->set('form', $form);
$response->set('title', $this->translate($this->config->getSectionTitle($sectionId)));
$response->set('values', $values);
$response->set('types', $types);
$response->set('id', $sectionId);
$response->set('sectionKey', array_pop(explode('.', $sectionId)));
$response->set('layout', $this->config->getSectionLayout($sectionId));
$response->set('multiLingualValues', $multiLingualValues);
return $response;
}
开发者ID:saiber,项目名称:www,代码行数:38,代码来源:SettingsController.php
示例5: lastViewed
public function lastViewed()
{
$response = new ActionResponse();
$response->set('randomToken', substr(md5(time() . mt_rand(1, 9999999999)), 0, 8));
$response->set('lastViewed', BackendToolbarItem::sanitizeItemArray(BackendToolbarItem::getUserToolbarItems(array(BackendToolbarItem::TYPE_PRODUCT, BackendToolbarItem::TYPE_USER, BackendToolbarItem::TYPE_ORDER), null, 'DESC')));
return $response;
}
开发者ID:saiber,项目名称:www,代码行数:7,代码来源:BackendToolbarController.php
示例6: index
public function index()
{
$response = new ActionResponse();
$response->set('isCustomizationModeEnabled', $this->application->isCustomizationMode());
$response->set('isTranslationModeEnabled', $this->application->isTranslationMode());
return $response;
}
开发者ID:saiber,项目名称:www,代码行数:7,代码来源:CustomizeController.php
示例7: index
/**
* Main settings page
*/
public function index()
{
$f = new ARSelectFilter();
$f->setOrder(new ARFieldHandle('StaticPage', 'position'));
$f->setOrder(new ARFieldHandle('StaticPage', 'parentID'));
$s = ActiveRecordModel::getRecordSetArray('StaticPage', $f);
$pages = array();
foreach ($s as $page) {
$pointers[$page['ID']] = array('title' => $page['title_lang'], 'id' => $page['ID'], 'parentID' => $page['parentID']);
}
foreach ($pointers as $page) {
if ($page['parentID'] && !empty($pointers[$page['parentID']])) {
$root =& $pointers[$page['parentID']];
} else {
$root =& $pages;
}
$root['children'][] =& $pointers[$page['id']];
}
$response = new ActionResponse();
$response->set('pages', json_encode($pages));
$form = $this->getForm();
$page = StaticPage::getNewInstance();
$page->getSpecification()->setFormResponse($response, $form);
$response->set('form', $form);
$response->set('page', $page->toArray());
return $response;
}
开发者ID:saiber,项目名称:livecart,代码行数:30,代码来源:StaticPageController.php
示例8: index
public function index()
{
// get filter to select manufacturers of active products only
$rootCat = Category::getRootNode();
$f = new ARSelectFilter();
$productFilter = new ProductFilter($rootCat, $f);
$ids = $counts = array();
foreach (ActiveRecordModel::getDataBySQL('SELECT DISTINCT(manufacturerID), COUNT(*) AS cnt FROM Product ' . $f->createString() . ' GROUP BY manufacturerID') as $row) {
$ids[] = $row['manufacturerID'];
$counts[$row['manufacturerID']] = $row['cnt'];
}
$f = new ARSelectFilter(new InCond(new ARFieldHandle('Manufacturer', 'ID'), $ids));
$f->mergeCondition(new NotEqualsCond(new ARFieldHandle('Manufacturer', 'name'), ''));
$f->setOrder(new ARFieldHandle('Manufacturer', 'name'));
$manufacturers = ActiveRecordModel::getRecordSetArray('Manufacturer', $f);
foreach ($manufacturers as &$manufacturer) {
$manufacturer['url'] = $this->getManufacturerFilterUrl($manufacturer);
}
$this->addBreadCrumb($this->translate('_manufacturers'), '');
$response = new ActionResponse();
$response->setReference('manufacturers', $manufacturers);
$response->set('counts', $counts);
$response->set('rootCat', $rootCat->toArray());
return $response;
}
开发者ID:saiber,项目名称:www,代码行数:25,代码来源:ManufacturersController.php
示例9: index
public function index()
{
$f = new ARSelectFilter();
$f->setOrder(new ARFieldHandle('NewsPost', 'position'), 'DESC');
$response = new ActionResponse('newsList', ActiveRecordModel::getRecordSetArray('NewsPost', $f));
$response->set('form', $this->buildForm());
return $response;
}
开发者ID:saiber,项目名称:livecart,代码行数:8,代码来源:SiteNewsController.php
示例10: index
public function index()
{
$response = new ActionResponse();
$response->set('id', $this->request->get('id'));
$response->set('ajax', $this->request->get('ajax'));
$response->set('description', HTTPStatusException::getCodeMeaning($this->request->get('id')));
return $response;
}
开发者ID:saiber,项目名称:www,代码行数:8,代码来源:ErrController.php
示例11: index
public function index()
{
$category = Category::getInstanceByID($this->request->get('id'), Category::LOAD_DATA);
$types = ProductRatingType::getCategoryRatingTypes($category)->toArray();
$response = new ActionResponse('typeList', $types);
$response->set('form', $this->buildForm());
$response->set('id', $this->request->get('id'));
return $response;
}
开发者ID:saiber,项目名称:livecart,代码行数:9,代码来源:RatingTypeController.php
示例12: edit
public function edit()
{
$group = UserGroup::getInstanceByID((int) $this->request->get('id'), true);
$form = $this->createUserGroupForm($group);
$response = new ActionResponse();
$response->set('userGroup', $group->toArray());
$response->set('userGroupForm', $form);
$group->getSpecification()->setFormResponse($response, $form);
return $response;
}
开发者ID:saiber,项目名称:livecart,代码行数:10,代码来源:UserGroupController.php
示例13: edit
public function edit()
{
$tax = Tax::getInstanceByID((int) $this->request->get('id'), true);
$form = $this->createTaxForm($tax);
$form->setData($tax->toArray());
$response = new ActionResponse();
$response->set('tax', $tax->toArray());
$response->set('taxForm', $form);
return $this->appendTaxRates($response, $tax->getID());
}
开发者ID:saiber,项目名称:www,代码行数:10,代码来源:TaxController.php
示例14: edit
public function edit()
{
$class = ShippingClass::getInstanceByID((int) $this->request->get('id'), true);
$form = $this->createClassForm($class);
$form->setData($class->toArray());
$response = new ActionResponse();
$response->set('class', $class->toArray());
$response->set('classForm', $form);
return $response;
}
开发者ID:saiber,项目名称:www,代码行数:10,代码来源:ShippingClassController.php
示例15: index
public function index()
{
$f = new ARSelectFilter();
$f->setOrder(new ARFieldHandle('EyeExamSchedule', 'doctorName'), 'ASC');
$f->setOrder(new ARFieldHandle('EyeExamSchedule', 'date'), 'DESC');
$f->setOrder(new ARFieldHandle('EyeExamSchedule', 'time'), 'ASC');
$arrEyeSchedule = ActiveRecordModel::getRecordSetArray('EyeExamSchedule', $f);
$response = new ActionResponse('eyeExamList', self::loadFormattedReferences($arrEyeSchedule));
$response->set('form', $this->buildForm());
$curDate = date("Y-m-d");
$response->set('curDate', $curDate);
return $response;
}
开发者ID:saiber,项目名称:www,代码行数:13,代码来源:EyeExamScheduleController.php
示例16: index
public function index()
{
$product = Product::getInstanceById($this->request->get('id'), ActiveRecord::LOAD_DATA, array('Category'));
$product->category->get()->getPathNodeSet();
$additional = $product->getAdditionalCategories();
foreach ($additional as $category) {
$category->getPathNodeSet();
}
$response = new ActionResponse('product', $product->toArray());
if ($additional) {
$response->set('categories', ARSet::buildFromArray($additional)->toArray());
}
return $response;
}
开发者ID:saiber,项目名称:livecart,代码行数:14,代码来源:ProductCategoryController.php
示例17: index
public function index()
{
if (($zoneID = (int) $this->request->get('id')) <= 0) {
$deliveryZoneArray = array('ID' => '');
$shippingServices = ShippingService::getByDeliveryZone();
} else {
$deliveryZone = DeliveryZone::getInstanceByID($zoneID, true);
$deliveryZoneArray = $deliveryZone->toArray();
$shippingServices = $deliveryZone->getShippingServices();
}
$shippingServicesArray = array();
foreach ($shippingServices as $service) {
$shippingServicesArray[$service->getID()] = $service->toArray();
$shippingServicesArray[$service->getID()]['rangeTypeString'] = $this->translate($service->rangeType->get() == 0 ? '_weight_based_rates' : '_subtotal_based_rates');
$shippingServicesArray[$service->getID()]['ratesCount'] = $service->getRates()->getTotalRecordCount();
}
$form = $this->createShippingServiceForm();
$form->setData(array('rangeType' => 0));
$response = new ActionResponse();
$response->set('shippingServices', $shippingServicesArray);
$response->set('newService', array('DeliveryZone' => $deliveryZoneArray));
$response->set('newRate', array('ShippingService' => array('DeliveryZone' => $deliveryZoneArray, 'ID' => '')));
$response->set('deliveryZone', $deliveryZoneArray);
$response->set('defaultCurrencyCode', $this->application->getDefaultCurrency()->getID());
$response->set('form', $form);
return $response;
}
开发者ID:saiber,项目名称:livecart,代码行数:27,代码来源:ShippingServiceController.php
示例18: upload
public function upload()
{
$request = $this->getRequest();
$theme = $request->get('theme');
$tfh = ThemeFile::getNewInstance($request->get('theme'));
$res = $tfh->processFileUpload('file', $request->get('filename'), $request->get('orginalFileName'));
$this->setLayout('iframeJs');
$response = new ActionResponse();
$response->set('theme', $theme);
$response->set('result', json_encode($tfh->getFiles()));
if (is_array($res)) {
$response->set('highlightFileName', $res['filename']);
}
return $response;
}
开发者ID:saiber,项目名称:www,代码行数:15,代码来源:ThemeFileController.php
示例19: index
public function index()
{
$dir = getcwd();
@chdir('/');
$root = array('parent' => 0, 'ID' => getcwd(), 'name' => getcwd(), 'childrenCount' => 22);
$response = new ActionResponse();
$response->set('directoryList', $this->getSubDirectories(getcwd()));
$response->set('root', array(0 => $root));
$response->set('current', $dir);
$this->setGridResponse($response);
$response->set('offset', 0);
$response->set('data', '');
//print_r($response->getData());
return $response;
}
开发者ID:saiber,项目名称:www,代码行数:15,代码来源:SelectFileController.php
示例20: lastViewed
public function lastViewed()
{
$request = $this->getRequest();
$where = $request->get('where');
$response = new ActionResponse();
$response->set('randomToken', substr(md5(time() . mt_rand(1, 9999999999)), 0, 8));
$response->set('where', $where);
$lastViewed = BackendToolbarItem::sanitizeItemArray(BackendToolbarItem::getUserToolbarItems(array(BackendToolbarItem::TYPE_PRODUCT, BackendToolbarItem::TYPE_USER, BackendToolbarItem::TYPE_ORDER), null, 'DESC'));
$itemsByType = array();
foreach ($lastViewed as $item) {
$itemsByType[$item['type']][] = $item;
}
$response->set('itemsByType', $itemsByType);
return $response;
}
开发者ID:saiber,项目名称:livecart,代码行数:15,代码来源:BackendToolbarController.php
注:本文中的ActionResponse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论