本文整理汇总了PHP中Fox::getHelper方法的典型用法代码示例。如果您正苦于以下问题:PHP Fox::getHelper方法的具体用法?PHP Fox::getHelper怎么用?PHP Fox::getHelper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fox
的用法示例。
在下文中一共展示了Fox::getHelper方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveAction
/**
* Save action
*/
public function saveAction()
{
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost();
try {
$model = Fox::getModel('member/member');
$model->load($data['email_id'], 'email_id');
if ($model->getId()) {
if ($data['password'] == $data['c_password']) {
$model->setPassword(md5($data['password']));
$model->save();
$model->sendPasswordChangedMail($data['password']);
Fox::getHelper('core/message')->setInfo('Password was successfully changed.');
} else {
throw new Exception('Password must match confirm password.');
}
} else {
throw new Exception('Email Id was not found.');
}
} catch (Exception $e) {
Fox::getModel('core/session')->setFormData($data);
Fox::getHelper('core/message')->setError($e->getMessage());
}
}
$this->sendRedirect('*/*/change-password');
}
示例2: pageNotFoundAction
/**
* Page not found action
*/
public function pageNotFoundAction()
{
$this->getResponse()->setHeader('HTTP/1.1', '404 Not Found');
$this->getResponse()->setHeader('Status', '404 File not found');
if (!Fox::getHelper('core/router')->routKey($this, 'no-page-404')) {
$this->_forward('nothing');
}
}
示例3: saveAnalyticsData
/**
* Fetches and writes analytics data to cache and database
*/
public function saveAnalyticsData()
{
try {
if (!$this->isTodaysFileExists()) {
$dayTimeStamp = 24 * 60 * 60;
$prevDateTimeStamp = time();
$dataArray = array();
$fromDate = date('Y-m-d', $prevDateTimeStamp - 30 * $dayTimeStamp);
$toDate = date('Y-m-d', $prevDateTimeStamp - $dayTimeStamp);
$analyticsData = Fox::getModel('admin/analytics')->getAnalyticsData($fromDate, $toDate);
$model = Fox::getModel('admin/analytics');
$ga_profile_id = $this->getProfileId();
for ($i = 30; $i >= 1; $i--) {
$date = date('Y-m-d', $prevDateTimeStamp - $i * $dayTimeStamp);
$value = Fox_Core_Model_Date::__toLocaleDate(strtotime($date), "d-M-Y");
$total_results = 0;
$page_views = 0;
$visits = 0;
if (false && array_key_exists($date, $analyticsData)) {
$total_results = $analyticsData[$date]['page_views'];
$page_views = $analyticsData[$date]['total_results'];
$visits = $analyticsData[$date]['total_visits'];
} else {
$results = $this->requestReportData($ga_profile_id, $date, $date);
if (count($results) > 0) {
$page_views = $results['page_views'];
$visits = $results['visits'];
}
$model->setDateValue($date);
$model->setTotalResults($total_results);
$model->setPageViews($page_views);
$model->setTotalVisits($visits);
$model->save();
$model->unsetData();
}
$dataArray[$i]['value'] = $value;
$dataArray[$i]['page_views'] = $page_views;
$dataArray[$i]['total_visits'] = $visits;
}
$this->writeData($dataArray);
}
} catch (Exception $e) {
Fox::getHelper('core/message')->setError($e->getMessage());
}
}
示例4: saveAction
/**
* Save action
*/
function saveAction()
{
if ($this->getRequest()->isPost()) {
try {
$data = $this->getRequest()->getPost();
// Uni_Core_ModuleManager::runSqlUpgrade('News', 'Fox', 'core');
// exit;
Uni_Core_ModuleManager::installModules();
Uni_Core_ModuleManager::updateModuleStatus($data);
Uni_Core_Preferences::loadPreferences(TRUE);
Uni_Core_CacheManager::clearLayoutCache();
Uni_Core_CacheManager::clearModuleCache();
Fox::getHelper('core/message')->setInfo('Modules successfully saved.');
} catch (Exception $e) {
Fox::getHelper('core/message')->setError($e->getMessage());
}
}
$this->sendRedirect('*/*/');
}
示例5: indexAction
/**
* Index action
*/
public function indexAction()
{
if ($this->getRequest()->isPost()) {
try {
$data = $this->getRequest()->getPost();
$model = Fox::getModel('contact/contact');
$data['status'] = Fox_Contact_Model_Contact::STATUS_UNREAD;
$data['contact_date'] = Fox_Core_Model_Date::getCurrentDate('Y-m-d H:i:s');
$model->setData($data);
$model->save();
try {
Fox::getHelper('core/message')->setInfo("Your request was successfully sent.");
$modelTemplate = Fox::getModel('core/email/template');
$modelTemplate->sendTemplateMail(Fox::getPreference('contact/receiver/email_template'), Fox::getPreference('contact/receiver/email'), array('sender_name' => $data['name'], 'sender_email' => $data['email']), $data);
} catch (Exception $e) {
}
} catch (Exception $e) {
Fox::getHelper('core/message')->setError($e->getMessage());
}
}
$this->loadLayout();
$this->renderLayout();
}
示例6: changePasswordAction
/**
* Change password action
*
* Member is redirected to change password interface from the link sent via email for forgot password
*/
public function changePasswordAction()
{
$code = $this->getRequest()->getParam('code', FALSE);
try {
$model = Fox::getModel('member/password');
if (!$code) {
$this->sendRedirect('*/account/login');
} else {
$model->load($code, 'code');
if (!$model->getId()) {
throw new Exception('Change password link was incorrect or expired.');
}
}
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost();
if ($data['password'] == $data['c_password']) {
$memberModel = Fox::getModel('member/member');
$memberModel->load($model->getMemId());
if ($memberModel->getId()) {
$memberModel->setPassword(md5($data['password']));
$memberModel->save();
$memberModel->sendPasswordChangedMail($data['password']);
$model->delete();
Fox::getHelper('core/message')->setInfo('Password was successfully changed.');
$this->sendRedirect('*/account/login');
}
} else {
Fox::getHelper('core/message')->setError('New password must match confirm new password.');
}
}
} catch (Exception $e) {
Fox::getHelper('core/message')->setError($e->getMessage());
$this->sendRedirect('*/account/login');
}
$this->loadLayout();
$this->renderLayout();
}
示例7: getRegisterUrl
/**
* Get member registration url
*
* @return string
*/
function getRegisterUrl()
{
return Fox::getHelper('member/data')->getRegisterUrl();
}
示例8: groupDeleteAction
/**
* Bulk delete action
*/
public function groupDeleteAction()
{
try {
$model = Fox::getModel('eav/attribute');
$ids = $this->getGroupActionIds($model);
$totalIds = count($ids);
if ($totalIds) {
$model->delete($model->getPrimaryField() . ' IN (' . implode(',', $ids) . ')');
}
Fox::getHelper('core/message')->setInfo('Total ' . $totalIds . ' record(s) successfully deleted.');
} catch (Exception $e) {
Fox::getHelper('core/message')->setError($e->getMessage());
}
echo Zend_Json_Encoder::encode(array('redirect' => Fox::getUrl('*/*/')));
}
示例9: administratorAction
/**
* Admin panel configuration action
*/
public function administratorAction()
{
Fox::getModel('installer/session')->setCurrentStep(4);
try {
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost();
Fox::getModel('installer/session')->setBackend($data);
if (!$data['password'] || $data['password'] != $data['confirm_password']) {
throw new Exception('Password and Confirm Password do not match');
}
Uni_Core_Installer::finishSetup();
$this->sendRedirect('*/*/finish');
}
} catch (Exception $e) {
Fox::getHelper('core/message')->setError($e->getMessage());
}
$this->loadLayout();
$this->renderLayout();
}
示例10: deleteAction
/**
* Delete action
*/
public function deleteAction()
{
if ($id = $this->getRequest()->getParam('id')) {
try {
$model = Fox::getModel('core/email/template');
$model->load($id);
if ($model->getId()) {
$model->delete();
Fox::getHelper('core/message')->setInfo('"' . $model->getName() . '" was successfully deleted.');
}
} catch (Exception $e) {
Fox::getHelper('core/message')->addError($e->getMessage());
$this->sendRedirect('*/*/edit', array('id' => $id));
}
}
$this->sendRedirect('*/*/');
}
示例11: finishUpgradeAction
/**
* Finish Upgrade Action
*/
public function finishUpgradeAction()
{
$result = array('html' => '', 'success' => false);
if (!$this->isAjax()) {
$this->_forward('error');
return;
}
$package = $this->getPackage();
$config = $package->getConfig();
$packageKey = Fox::getHelper("extensionmanager/data")->decrypt($this->getRequest()->getPost("key"));
$filePath = $config->getInstalledPkgPath() . DS . $packageKey . '.xml';
if (!is_dir($filePath) && file_exists($filePath)) {
@unlink($filePath);
}
$result["success"] = true;
$result["state"] = "Upgrading Done";
$result["update"] = $this->_getUpdatedSection();
$this->getResponse()->setBody(Zend_Json::encode($result));
return;
}
示例12: unsubscribeAction
/**
* Unsubscribe action
*/
public function unsubscribeAction()
{
$id = $this->getRequest()->getParam('id', FALSE);
$code = $this->getRequest()->getParam('code', FALSE);
if ($id && $code) {
try {
$subscriber = Fox::getModel('newsletter/subscriber');
$subscriber->load($id);
if ($code == $subscriber->getCode()) {
if ($subscriber->unsubscribe()) {
Fox::getHelper('core/message')->setInfo('You have been successfully unsubscribed.');
}
} else {
Fox::getHelper('core/message')->setError('Invalid subscription confirmation code');
}
} catch (Exception $e) {
Fox::getHelper('core/message')->setError('There was a problem with the un-subscription.');
}
}
$this->sendRedirect('');
}
示例13: groupStatusAction
/**
* Bulk status update action
*/
public function groupStatusAction()
{
try {
$model = Fox::getModel('core/cache');
$codes = $this->getGroupActionIds($model);
$totalIds = count($codes);
$updateType = '';
$dependentParams = $this->getRequest()->getParam('dependents', array());
if (isset($dependentParams['status'])) {
if ($dependentParams['status'] == Fox_Core_Model_Cache::STATUS_CLEAR) {
$updateType = 'cleared';
if (in_array(Fox_Core_Model_Cache::CACHE_CODE_PREFERENCE, $codes)) {
Uni_Core_Preferences::loadPreferences(TRUE);
Fox::initializePreferences();
}
if (in_array(Fox_Core_Model_Cache::CACHE_CODE_LAYOUT, $codes)) {
Uni_Core_CacheManager::clearLayoutCache();
}
} else {
if ($dependentParams['status'] == Fox_Core_Model_Cache::STATUS_ENABLED) {
$updateType = 'enabled';
} else {
if ($dependentParams['status'] == Fox_Core_Model_Cache::STATUS_DISABLED) {
$updateType = 'disabled';
}
}
$cacheCodes = '\'' . implode('\',\'', $codes) . '\'';
$model->update(array('status' => $dependentParams['status']), 'cache_code IN (' . $cacheCodes . ')');
}
Uni_Core_CacheManager::createCacheSettings();
Fox::getHelper('core/message')->setInfo('Total ' . $totalIds . ' cache(s) successfully ' . $updateType . '.');
}
} catch (Exception $e) {
Fox::getHelper('core/message')->setError($e->getMessage());
}
echo Zend_Json_Encoder::encode(array('redirect' => Fox::getUrl('*/*/')));
}
示例14: getFinalMenuTree
/**
* Prepares final menu html
*
* @param DOMElement $menu
*/
protected function getFinalMenuTree($menu)
{
if (NULL == $this->mnuPaths) {
$this->mnuPaths = array();
}
$sourceQueue = array(array('menu' => $menu, 'path' => 'root'));
$targetQueue = array($this->root);
while (count($sourceQueue) > 0) {
$mnuItem = array_shift($sourceQueue);
$menu = $mnuItem['menu'];
$parentPath = $mnuItem['path'];
$parent = array_shift($targetQueue);
if ($mChs = $menu->childNodes) {
foreach ($mChs as $mCh) {
if ($mCh->nodeName == 'item') {
if (Fox::getHelper('admin/acl')->isAllowed($mCh->getAttribute('action'))) {
$node = Uni_Data_XDOMDocument::createNode('item', array('action' => $mCh->getAttribute('action'), 'order' => ($order = $mCh->getAttribute('order')) ? $order : '0'), $this->finalMenuTree);
$node->appendChild($this->finalMenuTree->createTextNode($mCh->nodeValue));
$parent->appendChild($node);
}
} else {
if ($mCh->nodeName == 'menu') {
$label = $mCh->getAttribute('label');
$menuPath = $parentPath . '/' . str_replace('/', '_', $label);
if (isset($this->mnuPaths[$menuPath])) {
$item = $this->mnuPaths[$menuPath];
} else {
$item = Uni_Data_XDOMDocument::createNode('menu', array('label' => $label, 'order' => ($order = $mCh->getAttribute('order')) ? $order : '0'), $this->finalMenuTree);
$parent->appendChild($item);
$this->mnuPaths[$menuPath] = $item;
}
$targetQueue[] = $item;
$sourceQueue[] = array('menu' => $mCh, 'path' => $menuPath);
}
}
}
}
}
}
示例15: groupStatusAction
/**
* Bulk status update action
*/
public function groupStatusAction()
{
try {
$model = Fox::getModel('navigation/menu');
$ids = $this->getGroupActionIds($model);
$totalIds = count($ids);
$dependentParams = $this->getRequest()->getParam('dependents', array());
if (isset($dependentParams['status'])) {
if ($totalIds) {
$model->update(array('status' => $dependentParams['status']), $model->getPrimaryField() . ' IN (' . implode(',', $ids) . ')');
}
Fox::getHelper('core/message')->setInfo('Total ' . $totalIds . ' record(s) successfully updated.');
}
} catch (Exception $e) {
Fox::getHelper('core/message')->setError($e->getMessage());
}
echo Zend_Json_Encoder::encode(array('redirect' => Fox::getUrl('*/*/')));
}