本文整理汇总了PHP中ActionResponse类的典型用法代码示例。如果您正苦于以下问题:PHP ActionResponse类的具体用法?PHP ActionResponse怎么用?PHP ActionResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ActionResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例3: index
public function index()
{
$this->loadLanguageFile('User');
$response = new ActionResponse('email', $this->request->get('email'));
$response->setHeader('NeedLogin', 1);
return $response;
}
示例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;
}
示例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;
}
示例6: index
public function index()
{
$response = new ActionResponse();
$response->set('isCustomizationModeEnabled', $this->application->isCustomizationMode());
$response->set('isTranslationModeEnabled', $this->application->isTranslationMode());
return $response;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}