本文整理汇总了PHP中Axis::message方法的典型用法代码示例。如果您正苦于以下问题:PHP Axis::message方法的具体用法?PHP Axis::message怎么用?PHP Axis::message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Axis
的用法示例。
在下文中一共展示了Axis::message方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendJson
/**
* Encode JSON response and immediately send
*
* @param mixed $data
* @param boolean|array $keepLayouts
* NOTE: if boolean, establish $keepLayouts to true|false
* if array, admit params for Zend_Json::encode as enableJsonExprFinder=>true|false
* if $keepLayouts and parmas for Zend_Json::encode are required
* then, the array can contains a 'keepLayout'=>true|false
* that will not be passed to Zend_Json::encode method but will be passed
* to Zend_View_Helper_Json
* @param bool $wrap
* @return string|void
*/
public function sendJson($data, $keepLayouts = false, $wrap = true)
{
if (!is_array($data)) {
return parent::sendJson($data, $keepLayouts);
}
if (isset($data['success']) && !is_bool($data['success'])) {
$data['success'] = (bool) $data['success'];
}
if ($wrap) {
$messages = Axis::message()->getAll();
// if (isset(false === $data['success']) && $data['success']) {
// unset($messages['success']);
// }
$data = array_merge(array('messages' => $messages), $data);
}
if ($this->_data) {
$data = array_merge_recursive($this->_data, $data);
}
$data = $this->encodeJson($data, $keepLayouts);
$response = $this->getResponse();
$response->setBody($data);
if (!$this->suppressExit) {
Zend_Wildfire_Channel_HttpHeaders::getInstance()->flush();
//Axis_FirePhp
$response->sendResponse();
exit;
}
return $data;
}
示例2: getSaveValue
/**
*
* @param mixed $value
* @return mixed
*/
public static function getSaveValue($value)
{
if (!is_array($value)) {
return $value;
}
function remove_quotes(&$str)
{
$str = str_replace(array('"', "'"), '', $str);
}
$filename = Axis::config()->system->path . '/var/export/' . current($value);
if (@(!($fp = fopen($filename, 'r')))) {
Axis::message()->addError(Axis::translate('core')->__("Can't open file : %s", $filename));
return current($value);
}
$titles = fgetcsv($fp, 2048, ',', "'");
array_walk($titles, 'remove_quotes');
$rowSize = count($titles);
Axis::table('shippingtable_rate')->delete("site_id = " . $value['siteId']);
while (!feof($fp)) {
$data = fgetcsv($fp, 2048, ',', "'");
if (!is_array($data)) {
continue;
}
$data = array_pad($data, $rowSize, '');
array_walk($data, 'remove_quotes');
$data = array_combine($titles, $data);
Axis::table('shippingtable_rate')->insert(array('site_id' => $value['siteId'], 'country_id' => Axis::single('location/country')->getIdByIsoCode3($data['Country']), 'zone_id' => Axis::single('location/zone')->getIdByCode($data['Region/State']), 'zip' => $data['Zip'], 'value' => $data['Value'], 'price' => $data['Price']));
}
return current($value);
}
示例3: addAction
/**
* Customer add new tag on product
* @return void
*/
public function addAction()
{
$tags = array_filter(explode(',', $this->_getParam('tags')));
$productId = $this->_getParam('productId');
$modelCustomer = Axis::model('tag/customer');
$modelProduct = Axis::model('tag/product');
$defaultStatus = $modelCustomer->getDefaultStatus();
$customerId = Axis::getCustomerId();
$siteId = Axis::getSiteId();
$_row = array('customer_id' => $customerId, 'site_id' => $siteId, 'status' => $modelCustomer->getDefaultStatus());
foreach ($tags as $tag) {
$row = $modelCustomer->select()->where('name = ?', $tag)->where('customer_id = ?', $customerId)->where('site_id = ?', $siteId)->fetchRow();
if (!$row) {
$_row['name'] = $tag;
$row = $modelCustomer->createRow($_row);
$row->save();
Axis::message()->addSuccess(Axis::translate('tag')->__("Tag '%s' was successfully added to product", $tag));
} else {
Axis::message()->addNotice(Axis::translate('tag')->__("Your tag '%s' is already added to this product", $tag));
}
// add to product relation
$isExist = (bool) $modelProduct->select('id')->where('customer_tag_id = ?', $row->id)->where('product_id = ?', $productId)->fetchOne();
if (!$isExist) {
$modelProduct->createRow(array('customer_tag_id' => $row->id, 'product_id' => $productId))->save();
}
Axis::dispatch('tag_product_add_success', array('tag' => $tag, 'product_id' => $productId));
}
$this->_redirect($this->getRequest()->getServer('HTTP_REFERER'));
}
示例4: removeAction
public function removeAction()
{
$customerGroupIds = Zend_Json::decode($this->_getParam('data'));
$isValid = true;
if (in_array(Axis_Account_Model_Customer_Group::GROUP_GUEST_ID, $customerGroupIds)) {
$isValid = false;
Axis::message()->addError(Axis::translate('admin')->__("Your can't delete default Guest group id: %s ", Axis_Account_Model_Customer_Group));
}
if (in_array(Axis_Account_Model_Customer_Group::GROUP_ALL_ID, $customerGroupIds)) {
$isValid = false;
Axis::message()->addError(Axis::translate('admin')->__("Your can't delete default All group id: %s ", Axis_Account_Model_Customer_Group::GROUP_ALL_ID));
}
if (true === in_array(Axis::config()->account->main->defaultCustomerGroup, $customerGroupIds)) {
$isValid = false;
Axis::message()->addError(Axis::translate('admin')->__("Your can't delete default customer group id: %s ", $id));
}
if (!sizeof($customerGroupIds)) {
$isValid = false;
Axis::message()->addError(Axis::translate('admin')->__('No data to delete'));
}
if ($isValid) {
Axis::single('account/customer_group')->delete($this->db->quoteInto('id IN(?)', $customerGroupIds));
Axis::message()->addSuccess(Axis::translate('admin')->__('Group was deleted successfully'));
}
$this->_helper->json->sendJson(array('success' => $isValid));
}
示例5: log
/**
* Loging
*
* @param mixed $message
*/
public function log($message)
{
if ($this->_config->showErrors) {
Axis::message()->addError($this->_code . ': ' . $message);
}
$this->_logger->info($this->_code . ' ' . $message);
}
示例6: postProcess
public function postProcess(Axis_Sales_Model_Order_Row $order)
{
$this->saveCreditCard($order);
$cc = $this->getCreditCard();
$options = $this->getLineItemDetails();
$billing = $order->getBilling();
$optionsAll = array_merge($options, array('STREET' => $billing->getStreetAddress(), 'ZIP' => $billing->getPostcode(), 'BUTTONSOURCE' => $this->_buttonSourceDP, 'CURRENCY' => $this->getBaseCurrencyCode(), 'IPADDRESS' => $_SERVER['REMOTE_ADDR']));
if ($cc->getCcIssueMonth() && $cc->getCcIssueYear()) {
$optionsAll['CARDSTART'] = $cc->getCcIssueMonth() . substr($cc->getCcIssueYear(), -2);
}
$optionsNVP = array('CITY' => $billing->getCity(), 'STATE' => $billing->getZone()->getCode() ? $billing->getZone()->getCode() : $billing->getCity(), 'COUNTRYCODE' => $billing->getCountry()->getIsoCode2(), 'EXPDATE' => $cc->getCcExpiresMonth() . $cc->getCcExpiresYear(), 'PAYMENTACTION' => $this->_config->paymentAction == 'Authorization' ? 'Authorization' : 'Sale');
$delivery = $order->getDelivery();
$optionsShip = array('SHIPTONAME' => $delivery->getFirstname() . ' ' . $delivery->getLastname(), 'SHIPTOSTREET' => $delivery->getStreetAddress(), 'SHIPTOSTREET2' => $delivery->getSuburb(), 'SHIPTOCITY' => $delivery->getCity(), 'SHIPTOZIP' => $delivery->getPostcode(), 'SHIPTOSTATE' => $delivery->getZone()->getCode() ? $delivery->getZone()->getCode() : $delivery->getCity(), 'SHIPTOCOUNTRYCODE' => $delivery->getCountry()->getIsoCode2());
// if these optional parameters are blank, remove them from transaction
if (isset($optionsShip['SHIPTOSTREET2']) && empty($optionsShip['SHIPTOSTREET2'])) {
unset($optionsShip['SHIPTOSTREET2']);
}
$response = $this->getApi()->DoDirectPayment(sprintf('%.2f', $this->getAmountInBaseCurrency($order->order_total)), $cc->getCcNumber(), $cc->getCcCvv(), $cc->getCcExpiresMonth() . $cc->getCcExpiresYear(), $billing->getFirstname(), $billing->getLastname(), $cc->getCcType(), $optionsAll, array_merge($optionsNVP, $optionsShip));
if ($response['ACK'] != 'Success') {
$this->log("Response : " . Zend_Debug::dump($response, null, false));
foreach ($this->getMessages($response) as $severity => $messages) {
Axis::message()->batchAdd($messages, $severity);
}
throw new Axis_Exception('DoDirectPayment Failure');
}
}
示例7: removeAction
public function removeAction()
{
$id = $this->_getParam('id');
Axis::model('admin/acl_role')->delete($this->db->quoteInto('id = ?', $id));
Axis::message()->addSuccess(Axis::translate('admin')->__('Role was deleted successfully'));
return $this->_helper->json->sendSuccess();
}
示例8: removeAction
public function removeAction()
{
$data = Zend_Json::decode($this->_getParam('data'));
Axis::model('account/customer_valueSet')->delete($this->db->quoteInto('id IN (?)', $data));
Axis::message()->addSuccess(Axis::translate('admin')->__('Group was deleted successfully'));
return $this->_helper->json->sendSuccess();
}
示例9: _available
/**
* @param int $quantity [optional]
* @param int $variationId [optional]
* @param boolean $isBackOrdered [optional]
* @return boolean
*/
protected function _available($quantity = 1, $variationId = null, $isBackOrdered = false)
{
if (!$this->in_stock) {
Axis::message()->addError(Axis::translate('catalog')->__('Product is out of stock'));
return false;
}
if ($quantity < $this->min_qty_allowed || $quantity <= 0) {
Axis::message()->addError(Axis::translate('catalog')->__('Minimum allowed quantity is %d', $this->min_qty_allowed > 0 ? $this->min_qty_allowed : 1));
return false;
}
if ($quantity > $this->max_qty_allowed && $this->max_qty_allowed > 0) {
Axis::message()->addError(Axis::translate('catalog')->__('Maximum allowed quantity is %d', $this->max_qty_allowed));
return false;
}
$stockQuantity = $this->getQuantity($variationId);
$availableQuantity = $stockQuantity - $this->min_qty;
if ($isBackOrdered && $quantity > $availableQuantity && !$this->backorder) {
Axis::message()->addError(Axis::translate('catalog')->__('Only %d item(s) are available', $availableQuantity));
return false;
}
if (!$isBackOrdered && $quantity > $availableQuantity) {
Axis::message()->addError(Axis::translate('catalog')->__('Only %d item(s) are available', $availableQuantity));
return false;
}
return true;
}
示例10: removeAction
public function removeAction()
{
$data = Zend_Json::decode($this->_getParam('data'));
Axis::single('catalog/product_option')->delete($this->db->quoteInto('id IN (?)', $data));
Axis::message()->addSuccess(Axis::translate('catalog')->__('Option was deleted successfully'));
return $this->_helper->json->sendSuccess();
}
示例11: run
/**
* Execute multiqueries
*
* @param string $sql
* @return Axis_Install_Model_Installer provides fluent interface
* @throws Exception
*/
public function run($sql)
{
$tries = 0;
$stmts = $this->_splitMultiQuery($sql);
foreach ($stmts as $stmt) {
do {
$retry = false;
try {
// skip commented queries
if (0 === strpos($stmt, '--') || 0 === strpos($stmt, '/*')) {
continue;
}
Axis::db()->getConnection()->exec($stmt);
} catch (Exception $e) {
if ($e->getMessage() == 'SQLSTATE[HY000]: General error: 2013 Lost connection to MySQL server during query' && $tries < 10) {
$retry = true;
$tries++;
} else {
// Axis::message()->addError($e->getTraceAsString());
Axis::message()->addError($e->getMessage());
throw $e;
}
}
} while ($retry);
}
return $this;
}
示例12: removeAction
public function removeAction()
{
$data = Zend_Json::decode($this->_getParam('data'));
Axis::model('core/site')->delete($this->db->quoteInto('id IN(?)', $data));
Axis::dispatch('core_site_delete_success', array('site_ids' => $data));
Axis::message()->addSuccess(Axis::translate('admin')->__('Site was deleted successfully'));
return $this->_helper->json->sendSuccess();
}
示例13: log
/**
* Loging
*
* @param mixed $message
*/
public function log($message)
{
if ($this->_config->showErrors) {
Axis::message()->addError($this->_code . ': ' . $message);
}
if ($this->_logger instanceof Zend_Log) {
$this->_logger->info($this->_code . ' ' . $message);
}
}
示例14: batchSaveAction
public function batchSaveAction()
{
$_rowset = Zend_Json::decode($this->_getParam('data'));
$model = Axis::model('cms/page_comment');
foreach ($_rowset as $id => $_row) {
$model->find($id)->current()->setFromArray($_row)->save();
}
Axis::message()->addSuccess(Axis::translate('core')->__('Data was saved successfully'));
return $this->_helper->json->sendSuccess();
}
示例15: saveAction
public function saveAction()
{
$data = $this->_getAllParams();
$row = Axis::model('community/review')->save($data);
Axis::message()->addSuccess(Axis::translate('community')->__('Review was successfully saved'));
if (count($data['rating'])) {
$row->setRating($data['rating']);
}
return $this->_helper->json->sendSuccess();
}