本文整理匯總了PHP中OW::getRouter方法的典型用法代碼示例。如果您正苦於以下問題:PHP OW::getRouter方法的具體用法?PHP OW::getRouter怎麽用?PHP OW::getRouter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OW
的用法示例。
在下文中一共展示了OW::getRouter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
/**
* Controller's default action
*
* @param array $params
* @throws Redirect404Exception
*/
public function index(array $params)
{
if (!isset($params['sectionId']) || !($sectionId = (int) $params['sectionId'])) {
throw new Redirect404Exception();
}
$forumSection = $this->forumService->findSectionById($sectionId);
if (!$forumSection || $forumSection->isHidden) {
throw new Redirect404Exception();
}
$userId = OW::getUser()->getId();
$bcItems = array(array('href' => OW::getRouter()->urlForRoute('forum-default'), 'label' => OW::getLanguage()->text('forum', 'forum_index')), array('label' => $forumSection->name));
$breadCrumbCmp = new BASE_CMP_Breadcrumb($bcItems);
$this->addComponent('breadcrumb', $breadCrumbCmp);
$sectionGroupList = $this->forumService->getSectionGroupList($userId, $sectionId);
$authors = array();
foreach ($sectionGroupList as $section) {
foreach ($section['groups'] as $group) {
if (!$group['lastReply']) {
continue;
}
$id = $group['lastReply']['userId'];
if (!in_array($id, $authors)) {
array_push($authors, $id);
}
}
}
$this->assign('sectionGroupList', $sectionGroupList);
$userNames = BOL_UserService::getInstance()->getUserNamesForList($authors);
$this->assign('userNames', $userNames);
$displayNames = BOL_UserService::getInstance()->getDisplayNamesForList($authors);
$this->assign('displayNames', $displayNames);
$this->addComponent('search', new FORUM_CMP_ForumSearch(array('scope' => 'section', 'sectionId' => $sectionId)));
OW::getDocument()->setHeading(OW::getLanguage()->text('forum', 'forum'));
OW::getDocument()->setHeadingIconClass('ow_ic_forum');
}
示例2: __construct
public function __construct($params = array())
{
parent::__construct();
$service = BOL_BillingService::getInstance();
$gateway = $service->findGatewayByKey($params['gateway']);
if (!$gateway || $gateway->dynamic) {
$this->setVisible(false);
return;
}
$event = new BASE_CLASS_EventCollector('base.billing_add_gateway_product');
OW::getEventManager()->trigger($event);
$data = $event->getData();
$eventProducts = array();
if ($data) {
foreach ($data as $plugin) {
foreach ($plugin as $product) {
$id = $service->addGatewayProduct($gateway->id, $product['pluginKey'], $product['entityType'], $product['entityId']);
$product['id'] = $id;
$eventProducts[] = $product;
}
}
}
$products = $service->findGatewayProductList($gateway->id);
foreach ($eventProducts as &$prod) {
$prod['productId'] = !empty($products[$prod['id']]) ? $products[$prod['id']]['dto']->productId : null;
$prod['plugin'] = !empty($products[$prod['id']]) ? $products[$prod['id']]['plugin'] : null;
}
$this->assign('products', $eventProducts);
$this->assign('actionUrl', OW::getRouter()->urlFor('BASE_CTRL_Billing', 'saveGatewayProduct'));
$this->assign('backUrl', urlencode(OW::getRouter()->getBaseUrl() . OW::getRouter()->getUri()));
}
示例3: getRequestUri
/**
* Returns real request uri.
*
* @return string
*/
public function getRequestUri()
{
if ($this->uri === null) {
$this->uri = UTIL_Url::getRealRequestUri(OW::getRouter()->getBaseUrl(), $_SERVER['REQUEST_URI']);
}
return $this->uri;
}
示例4: index
public function index()
{
$language = OW::getLanguage();
OW::getDocument()->setHeading($language->text('mcompose', 'heading_configuration'));
OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel');
$this->assign('pluginUrl', 'http://www.oxwall.org/store/item/10');
if (!$this->plugin->isAvaliable()) {
$this->assign('avaliable', false);
return;
}
$this->assign('avaliable', true);
$settingUrl = OW::getRouter()->urlForRoute('mailbox_admin_config');
$this->assign('settingsUrl', $settingUrl);
$configs = OW::getConfig()->getValues('mcompose');
$features = array();
$features["friends"] = MCOMPOSE_CLASS_FriendsBridge::getInstance()->isActive();
$features["groups"] = MCOMPOSE_CLASS_GroupsBridge::getInstance()->isActive();
$features["events"] = MCOMPOSE_CLASS_EventsBridge::getInstance()->isActive();
$form = new MCOMPOSE_ConfigForm($configs, $features);
$this->addForm($form);
$this->assign("configs", $configs);
$this->assign("features", $features);
$this->assign("activeFeatures", array_filter($features));
if (OW::getRequest()->isPost() && $form->isValid($_POST)) {
if ($form->process($_POST)) {
OW::getFeedback()->info($language->text('mcompose', 'admin_settings_updated'));
$this->redirect(OW::getRouter()->urlForRoute('mcompose-admin'));
}
}
}
示例5: detectContext
private static function detectContext()
{
if (self::$context !== null) {
return;
}
if (defined('OW_USE_CONTEXT')) {
switch (true) {
case OW_USE_CONTEXT == 1:
self::$context = self::CONTEXT_DESKTOP;
return;
case OW_USE_CONTEXT == 1 << 1:
self::$context = self::CONTEXT_MOBILE;
return;
case OW_USE_CONTEXT == 1 << 2:
self::$context = self::CONTEXT_API;
return;
}
}
$context = self::CONTEXT_DESKTOP;
try {
$isSmart = UTIL_Browser::isSmartphone();
} catch (Exception $e) {
return;
}
if (defined('OW_CRON')) {
$context = self::CONTEXT_DESKTOP;
} else {
if (self::getSession()->isKeySet(OW_Application::CONTEXT_NAME)) {
$context = self::getSession()->get(OW_Application::CONTEXT_NAME);
} else {
if ($isSmart) {
$context = self::CONTEXT_MOBILE;
}
}
}
if (defined('OW_USE_CONTEXT')) {
if ((OW_USE_CONTEXT & 1 << 1) == 0 && $context == self::CONTEXT_MOBILE) {
$context = self::CONTEXT_DESKTOP;
}
if ((OW_USE_CONTEXT & 1 << 2) == 0 && $context == self::CONTEXT_API) {
$context = self::CONTEXT_DESKTOP;
}
}
if ((bool) OW::getConfig()->getValue('base', 'disable_mobile_context') && $context == self::CONTEXT_MOBILE) {
$context = self::CONTEXT_DESKTOP;
}
//temp API context detection
//TODO remake
$uri = UTIL_Url::getRealRequestUri(OW::getRouter()->getBaseUrl(), $_SERVER['REQUEST_URI']);
if (mb_strstr($uri, '/')) {
if (trim(mb_substr($uri, 0, mb_strpos($uri, '/'))) == 'api') {
$context = self::CONTEXT_API;
}
} else {
if (trim($uri) == 'api') {
$context = self::CONTEXT_API;
}
}
self::$context = $context;
}
示例6: __construct
public function __construct($name)
{
parent::__construct($name);
$this->setAction(OW::getRouter()->urlForRoute('ocsaffiliates.action_signup'));
$this->setAjax();
$lang = OW::getLanguage();
$affName = new TextField('name');
$affName->setRequired(true);
$affName->setLabel($lang->text('ocsaffiliates', 'affiliate_name'));
$this->addElement($affName);
$email = new TextField('email');
$email->setRequired(true);
$email->setLabel($lang->text('ocsaffiliates', 'email'));
$email->addValidator(new EmailValidator());
$this->addElement($email);
$password = new PasswordField('password');
$password->setRequired(true);
$password->setLabel($lang->text('ocsaffiliates', 'password'));
$this->addElement($password);
$payment = new Textarea('payment');
$payment->setRequired(true);
$payment->setLabel($lang->text('ocsaffiliates', 'payment_details'));
$this->addElement($payment);
if (OW::getConfig()->getValue('ocsaffiliates', 'terms_agreement')) {
$terms = new CheckboxField('terms');
$validator = new RequiredValidator();
$validator->setErrorMessage($lang->text('ocsaffiliates', 'terms_required_msg'));
$terms->addValidator($validator);
$this->addElement($terms);
}
$submit = new Submit('signup');
$submit->setValue($lang->text('ocsaffiliates', 'signup_btn'));
$this->addElement($submit);
$this->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n if ( !data.result ) {\n OW.error(data.error);\n }\n else {\n document.location.reload();\n }\n }");
}
示例7: __construct
public function __construct(BASE_CommentsParams $params, $id, $formName)
{
parent::__construct();
$language = OW::getLanguage();
$form = new Form($formName);
$textArea = new Textarea('commentText');
$textArea->setHasInvitation(true);
$textArea->setInvitation($language->text('base', 'comment_form_element_invitation_text'));
$form->addElement($textArea);
$hiddenEls = array('entityType' => $params->getEntityType(), 'entityId' => $params->getEntityId(), 'displayType' => $params->getDisplayType(), 'pluginKey' => $params->getPluginKey(), 'ownerId' => $params->getOwnerId(), 'cid' => $id, 'commentCountOnPage' => $params->getCommentCountOnPage(), 'isMobile' => 1);
foreach ($hiddenEls as $name => $value) {
$el = new HiddenField($name);
$el->setValue($value);
$form->addElement($el);
}
$submit = new Submit('comment-submit');
$submit->setValue($language->text('base', 'comment_add_submit_label'));
$form->addElement($submit);
$form->setAjax(true);
$form->setAction(OW::getRouter()->urlFor('BASE_CTRL_Comments', 'addComment'));
// $form->bindJsFunction(Form::BIND_SUBMIT, "function(){ $('#comments-" . $id . " .comments-preloader').show();}");
// $form->bindJsFunction(Form::BIND_SUCCESS, "function(){ $('#comments-" . $id . " .comments-preloader').hide();}");
$this->addForm($form);
OW::getDocument()->addOnloadScript("window.owCommentCmps['{$id}'].initForm('" . $textArea->getId() . "', '" . $submit->getId() . "');");
$this->assign('form', true);
$this->assign('id', $id);
}
示例8: __construct
public function __construct(BASE_CLASS_WidgetParameter $params)
{
parent::__construct();
$lang = OW::getLanguage();
$service = OCSTOPUSERS_BOL_Service::getInstance();
$limit = $params->customParamList['userCount'];
$list = $service->findList(1, $limit);
if ($list) {
$this->assign('list', $list);
$total = $service->countUsers();
$this->assign('total', $total);
$idList = array();
$scores = array();
$rates = array();
foreach ($list as $user) {
array_push($idList, $user['dto']->id);
$scores[$user['dto']->id] = $user['score'];
$rates[$user['dto']->id] = $user['rates'];
}
$avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars($idList);
foreach ($avatars as $userId => &$av) {
$av['title'] .= ' - ' . $lang->text('ocstopusers', 'rate_info', array('rates' => $rates[$userId], 'score' => floatval($scores[$userId])));
}
$this->assign('avatars', $avatars);
$this->assign('scores', $scores);
if ($total > $limit) {
$toolbar = array(array('href' => OW::getRouter()->urlForRoute('ocstopusers.list'), 'label' => OW::getLanguage()->text('base', 'view_all')));
$this->setSettingValue(self::SETTING_TOOLBAR, $toolbar);
}
} else {
$this->assign('list', null);
}
}
示例9: __construct
/**
* Constructor.
*/
public function __construct($params = array())
{
parent::__construct();
$userId = (int) $params['userId'];
$showMessage = (bool) $params['showMessage'];
$rspUrl = OW::getRouter()->urlFor('BASE_CTRL_User', 'deleteUser', array('user-id' => $userId));
$rspUrl = OW::getRequest()->buildUrlQueryString($rspUrl, array('showMessage' => (int) $showMessage));
$js = UTIL_JsGenerator::composeJsString('$("#baseDCButton").click(function()
{
var button = this;
OW.inProgressNode(button);
$.getJSON({$rsp}, function(r)
{
OW.activateNode(button);
if ( _scope.floatBox )
{
_scope.floatBox.close();
}
if ( _scope.deleteCallback )
{
_scope.deleteCallback(r);
}
});
});', array('rsp' => $rspUrl));
OW::getDocument()->addOnloadScript($js);
}
示例10: ganalytics_admin_notification
function ganalytics_admin_notification(BASE_CLASS_EventCollector $event)
{
$wpid = OW::getConfig()->getValue('ganalytics', 'web_property_id');
if (empty($wpid)) {
$event->add(OW::getLanguage()->text('ganalytics', 'admin_notification_text', array('link' => OW::getRouter()->urlForRoute('ganalytics_admin'))));
}
}
示例11: __construct
public function __construct()
{
parent::__construct('set-credits-form');
$this->setAjax(true);
$this->setAction(OW::getRouter()->urlFor('USERCREDITS_CTRL_Ajax', 'setCredits'));
$lang = OW::getLanguage();
$userIdField = new HiddenField('userId');
$userIdField->setRequired(true);
$this->addElement($userIdField);
$balance = new TextField('balance');
$this->addElement($balance);
$submit = new Submit('save');
$submit->setValue($lang->text('base', 'edit_button'));
$this->addElement($submit);
$js = 'owForms["' . $this->getName() . '"].bind("success", function(data){
if ( data.error ){
OW.error(data.error);
}
if ( data.message ) {
OW.info(data.message);
}
_scope.floatBox && _scope.floatBox.close();
_scope.callBack && _scope.callBack(data);
});';
OW::getDocument()->addOnloadScript($js);
}
示例12: profile
public function profile($paramList)
{
$userService = BOL_UserService::getInstance();
/* @var $userDao BOL_User */
$userDto = $userService->findByUsername($paramList['username']);
if ($userDto === null) {
throw new Redirect404Exception();
}
if (!OW::getUser()->isAuthorized('base', 'view_profile')) {
$status = BOL_AuthorizationService::getInstance()->getActionStatus('base', 'view_profile');
$this->assign('permissionMessage', $status['msg']);
return;
}
$eventParams = array('action' => 'base_view_profile', 'ownerId' => $userDto->id, 'viewerId' => OW::getUser()->getId());
$displayName = BOL_UserService::getInstance()->getDisplayName($userDto->id);
try {
OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
} catch (RedirectException $ex) {
throw new RedirectException(OW::getRouter()->urlForRoute('base_user_privacy_no_permission', array('username' => $displayName)));
}
$this->setPageTitle(OW::getLanguage()->text('base', 'profile_view_title', array('username' => $displayName)));
$this->setPageHeading(OW::getLanguage()->text('base', 'profile_view_heading', array('username' => $displayName)));
$this->setPageHeadingIconClass('ow_ic_user');
$profileHeader = OW::getClassInstance("BASE_MCMP_ProfileHeader", $userDto->id);
$this->addComponent("header", $profileHeader);
//Profile Info
$displayNameQuestion = OW::getConfig()->getValue('base', 'display_name_question');
$profileInfo = OW::getClassInstance("BASE_MCMP_ProfileInfo", $userDto->id, false, array($displayNameQuestion, "birthdate"));
$this->addComponent("info", $profileInfo);
$this->addComponent('contentMenu', OW::getClassInstance("BASE_MCMP_ProfileContentMenu", $userDto->id));
$this->addComponent('about', OW::getClassInstance("BASE_MCMP_ProfileAbout", $userDto->id, 80));
$place = BOL_MobileWidgetService::PLACE_MOBILE_PROFILE;
$this->initDragAndDrop($place, $userDto->id);
}
示例13: getData
public function getData(BASE_CLASS_WidgetParameter $params)
{
$count = (int) $params->customParamList['count'];
$userId = OW::getUser()->getId();
$service = OCSFAVORITES_BOL_Service::getInstance();
$lang = OW::getLanguage();
$router = OW::getRouter();
$multiple = OW::getConfig()->getValue('ocsfavorites', 'can_view') && OW::getUser()->isAuthorized('ocsfavorites', 'view_users');
$toolbar = array();
$lists = array();
$resultList = array();
$toolbar['my'] = array('label' => $lang->text('base', 'view_all'), 'href' => $router->urlForRoute('ocsfavorites.list'));
$lists['my'] = $service->findFavoritesForUser($userId, 1, $count);
if ($multiple) {
$toolbar['me'] = array('label' => $lang->text('base', 'view_all'), 'href' => $router->urlForRoute('ocsfavorites.added_list'));
$lists['me'] = $service->findUsersWhoAddedUserAsFavorite($userId, 1, $count);
$toolbar['mutual'] = array('label' => $lang->text('base', 'view_all'), 'href' => $router->urlForRoute('ocsfavorites.mutual_list'));
$lists['mutual'] = $service->findMutualFavorites($userId, 1, $count);
}
$this->setSettingValue(self::SETTING_TOOLBAR, array($toolbar['my']));
$resultList['my'] = array('menu-label' => $lang->text('ocsfavorites', 'my'), 'menu_active' => true, 'userIds' => $this->getIds($lists['my'], 'favoriteId'), 'toolbar' => array($toolbar['my']));
if ($multiple) {
if ($lists['me']) {
$resultList['me'] = array('menu-label' => $lang->text('ocsfavorites', 'who_added_me'), 'userIds' => $this->getIds($lists['me'], 'userId'), 'toolbar' => array($toolbar['me']));
}
if ($lists['mutual']) {
$resultList['mutual'] = array('menu-label' => $lang->text('ocsfavorites', 'mutual'), 'userIds' => $this->getIds($lists['mutual'], 'userId'), 'toolbar' => array($toolbar['mutual']));
}
}
return $resultList;
}
示例14: index
/**
* Default action
*/
public function index()
{
$language = OW::getLanguage();
$item = new BASE_MenuItem();
$item->setLabel($language->text('gphotoviewer', 'admin_menu_general'));
$item->setUrl(OW::getRouter()->urlForRoute('gphotoviewer.admin_config'));
$item->setKey('general');
$item->setIconClass('ow_ic_gear_wheel');
$item->setOrder(0);
$menu = new BASE_CMP_ContentMenu(array($item));
$this->addComponent('menu', $menu);
$configs = OW::getConfig()->getValues('gphotoviewer');
$configSaveForm = new ConfigSaveForm();
$this->addForm($configSaveForm);
if (OW::getRequest()->isPost() && $configSaveForm->isValid($_POST)) {
$res = $configSaveForm->process();
OW::getFeedback()->info($language->text('gphotoviewer', 'settings_updated'));
$this->redirect(OW::getRouter()->urlForRoute('gphotoviewer.admin_config'));
}
if (!OW::getRequest()->isAjax()) {
$this->setPageHeading(OW::getLanguage()->text('gphotoviewer', 'admin_config'));
$this->setPageHeadingIconClass('ow_ic_picture');
$elem = $menu->getElement('general');
if ($elem) {
$elem->setActive(true);
}
}
$configSaveForm->getElement('enablePhotoviewer')->setValue($configs['enable_photo_viewer']);
$configSaveForm->getElement('downloadable')->setValue($configs['can_users_to_download_photos']);
$configSaveForm->getElement('slideshowTime')->setValue($configs['slideshow_time_per_a_photo']);
}
示例15: payeer_add_admin_notification
function payeer_add_admin_notification(BASE_CLASS_EventCollector $coll)
{
$billingService = BOL_BillingService::getInstance();
if (!mb_strlen($billingService->getGatewayConfigValue(BILLINGPAYEER_CLASS_PayeerAdapter::GATEWAY_KEY, 'm_key')) && !mb_strlen($billingService->getGatewayConfigValue(BILLINGPAYEER_CLASS_PayeerAdapter::GATEWAY_KEY, 'm_shop'))) {
$coll->add(OW::getLanguage()->text('billingpayeer', 'plugin_configuration_notice', array('url' => OW::getRouter()->urlForRoute('billing_payeer_admin'))));
}
}