本文整理汇总了PHP中OW::getClassInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP OW::getClassInstance方法的具体用法?PHP OW::getClassInstance怎么用?PHP OW::getClassInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OW
的用法示例。
在下文中一共展示了OW::getClassInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
public function getList(array $params)
{
OW::getDocument()->setHeading(OW::getLanguage()->text('bookmarks', 'list_headint_title'));
$this->setTemplate(OW::getPluginManager()->getPlugin('bookmarks')->getCtrlViewDir() . 'list.html');
$userId = OW::getUser()->getId();
$page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
$userOnPage = (int) OW::getConfig()->getValue('base', 'users_on_page');
$first = ($page - 1) * $userOnPage;
$list = $this->service->findBookmarksUserIdList($userId, $first, $userOnPage, $params['category']);
$count = $this->service->findBookmarksCount($userId, $params['category']);
$sexValue = array();
$userDataList = array();
$questionService = BOL_QuestionService::getInstance();
$data = $questionService->getQuestionData($list, array('sex', 'googlemap_location', 'birthdate'));
foreach (BOL_QuestionValueDao::getInstance()->findQuestionValues('sex') as $sexDto) {
$sexValue[$sexDto->value] = $questionService->getQuestionValueLang('sex', $sexDto->value);
}
foreach ($data as $userId => $user) {
if (isset($user['birthdate'])) {
$date = UTIL_DateTime::parseDate($user['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$age = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
} else {
$age = '';
}
$userDataList[$userId] = array('info_gender' => !empty($user['sex']) && !empty($sexValue[$user['sex']]) ? $sexValue[$user['sex']] : '' . ' ' . $age, 'location' => !empty($user['googlemap_location']) ? $user['googlemap_location']['address'] : '');
}
$this->addComponent('list', OW::getClassInstance('BASE_CMP_Users', $userDataList, array(), $count));
}
示例2: onBeforeRender
public function onBeforeRender()
{
parent::onBeforeRender();
$avatarData = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($this->user->id));
$avatarDto = BOL_AvatarService::getInstance()->findByUserId($this->user->id);
$owner = false;
if (OW::getUser()->getId() == $this->user->getId()) {
$owner = true;
}
$isModerator = OW::getUser()->isAuthorized('base') || OW::getUser()->isAdmin();
$avatarData[$this->user->id]['src'] = BOL_AvatarService::getInstance()->getAvatarUrl($this->user->getId(), 1, null, true, !($owner || $isModerator));
$default_avatar['src'] = BOL_AvatarService::getInstance()->getDefaultAvatarUrl(1);
$user = array();
$user["avatar"] = !empty($avatarData[$this->user->id]['src']) ? $avatarData[$this->user->id] : $default_avatar;
$user["displayName"] = $avatarData[$this->user->id]["title"];
$this->assign("user", $user);
$this->addComponent('toolbar', OW::getClassInstance("BASE_MCMP_ProfileActionToolbar", $this->user->id));
$eventParams = array('action' => 'base_view_my_presence_on_site', 'ownerIdList' => array($this->user->id), 'viewerId' => OW::getUser()->getId());
$permissions = OW::getEventManager()->getInstance()->call('privacy_check_permission_for_user_list', $eventParams);
$showPresence = !(isset($permissions[$this->user->id]['blocked']) && $permissions[$this->user->id]['blocked'] == true);
$this->assign("showPresence", $showPresence);
$isOnline = null;
$activityStamp = null;
if ($showPresence) {
$onlineInfo = BOL_UserService::getInstance()->findOnlineStatusForUserList(array($this->user->id));
$isOnline = $onlineInfo[$this->user->id];
$activityStamp = $this->user->activityStamp;
}
$this->assign("isOnline", $isOnline);
$this->assign("avatarDto", $avatarDto);
$this->assign("activityStamp", $activityStamp);
$this->assign('owner', $owner);
$this->assign('isModerator', $isModerator);
}
示例3: index
public function index(array $params)
{
if (!($userId = OW::getUser()->getId())) {
throw new AuthenticateException();
}
$page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
$lang = OW::getLanguage();
$perPage = (int) OW::getConfig()->getValue('base', OW::getPluginManager()->isPluginActive('skadate') ? 'users_on_page' : 'users_count_on_page');
$guests = OCSGUESTS_BOL_Service::getInstance()->findGuestsForUser($userId, $page, $perPage);
$guestList = array();
if ($guests) {
foreach ($guests as $guest) {
$guestList[$guest->guestId] = array('last_visit' => $lang->text('ocsguests', 'visited') . ' ' . '<span class="ow_remark">' . $guest->visitTimestamp . '</span>');
}
$itemCount = OCSGUESTS_BOL_Service::getInstance()->countGuestsForUser($userId);
if (OW::getPluginManager()->isPluginActive('skadate')) {
$cmp = OW::getClassInstance('BASE_CMP_Users', $guestList, array(), $itemCount);
} else {
$guestsUsers = OCSGUESTS_BOL_Service::getInstance()->findGuestUsers($userId, $page, $perPage);
$cmp = new OCSGUESTS_CMP_Users($guestsUsers, $itemCount, $perPage, true, $guestList);
}
$this->addComponent('guests', $cmp);
} else {
$this->assign('guests', null);
}
$this->setPageHeading($lang->text('ocsguests', 'viewed_profile'));
$this->setPageTitle($lang->text('ocsguests', 'viewed_profile'));
OW::getNavigation()->activateMenuItem(OW_Navigation::MAIN, 'base', 'dashboard');
}
示例4: __construct
public function __construct()
{
parent::__construct();
$form = OW::getClassInstance('FEMALEREGONLYMEN_CLASS_QuickSearchForm', $this);
$this->addForm($form);
$this->assign('form', $form);
$this->assign('advancedUrl', OW::getRouter()->urlForRoute('users-search'));
$this->assign('questions', USEARCH_BOL_Service::getInstance()->getQuickSerchQuestionNames());
}
示例5: getUserList
protected function getUserList($data)
{
$userList = OW::getClassInstance("BASE_CMP_MiniAvatarUserList", $data["ids"]);
$userList->setEmptyListNoRender(true);
if (!empty($data["viewAllUrl"])) {
$userList->setViewMoreUrl($this->getUrl($data["viewAllUrl"]));
}
return array("label" => $this->getLocalizedText($data['label']), "list" => $userList->render());
}
示例6: smarty_function_component
/**
* Smarty component function.
*
* @author Sardar Madumarov <madumarov@gmail.com>
* @package ow.ow_smarty.plugin
* @since 1.0
*/
function smarty_function_component($params, $smarty)
{
if (!isset($params['class']) || !mb_strstr($params['class'], '_')) {
throw new InvalidArgumentException('Ivalid class name provided `' . $params['class'] . '`');
}
$class = trim($params['class']);
unset($params['class']);
$cmp = OW::getClassInstance($class, $params);
return $cmp->render();
}
示例7: forApproval
public function forApproval()
{
$this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCtrlViewDir() . 'user_list_index.html');
$language = OW::getLanguage();
$page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
list($list, $itemCount) = $this->getData('waiting-for-approval', ($page - 1) * $this->usersPerPage, $this->usersPerPage);
//$cmp = new BASE_Members($list, $itemCount, $this->usersPerPage, false, 'waiting-for-approval');
$cmp = OW::getClassInstance("BASE_Members", $list, $itemCount, $this->usersPerPage, false, 'waiting-for-approval');
$this->addComponent('cmp', $cmp);
$this->assign('listType', 'waiting-for-approval');
}
示例8: getInstance
/**
* Returns class instance
* @param $includeCache bool
* @return BOL_LanguageService
*/
public static function getInstance($includeCache = true)
{
if (!isset(self::$classInstance)) {
try {
self::$classInstance = OW::getClassInstance(self::class, $includeCache);
} catch (ReflectionException $ex) {
self::$classInstance = new self($includeCache);
}
}
return self::$classInstance;
}
示例9: __construct
public function __construct()
{
parent::__construct();
$form = OW::getClassInstance("MAILBOX_CLASS_NewMessageForm", $this);
/* @var $user MAILBOX_CLASS_NewMessageForm */
$this->addForm($form);
$this->assign('defaultAvatarUrl', BOL_AvatarService::getInstance()->getDefaultAvatarUrl());
$this->assign('displayCaptcha', false);
$configs = OW::getConfig()->getValues('mailbox');
$this->assign('enableAttachments', !empty($configs['enable_attachments']));
}
示例10: newMessage
public function newMessage()
{
$form = OW::getClassInstance("MAILBOX_CLASS_NewMessageForm");
/* @var $user MAILBOX_CLASS_NewMessageForm */
if ($form->isValid($_POST)) {
$result = $form->process();
exit(json_encode($result));
} else {
exit(json_encode(array($form->getErrors())));
}
}
示例11: getInstance
public static function getInstance()
{
if (static::$instance == null) {
try {
static::$instance = OW::getClassInstance(static::class);
} catch (ReflectionException $ex) {
static::$instance = new static();
}
}
return static::$instance;
}
示例12: index
public function index()
{
$this->assign('staticUrl', OW::getPluginManager()->getPlugin('spvideolite')->getStaticUrl());
$this->assign('embedForm', $this->embedForm);
$this->addComponent('dragDropCmp', OW::getClassInstance('SPVIDEOLITE_CMP_AjaxUpload'));
// call selected module upload template
$module = SPVIDEOLITE_BOL_Configs::getInstance()->get('processor');
$func = 'add';
if (SPVIDEOLITE_BOL_Configs::getInstance()->get('features.upload_video')) {
$viewPath = SPVIDEOLITE_BOL_Service::callProcessorFunction($module, 'getViewPath', $this);
$view = $func . '.html';
$this->assign('uploadFormTpl', $viewPath . DS . $view);
SPVIDEOLITE_BOL_Service::callProcessorFunction($module, $func, $this);
}
}
示例13: index
public function index()
{
OW::getDocument()->setDescription(OW::getLanguage()->text('base', 'users_list_user_search_meta_description'));
$this->addComponent('menu', BASE_CTRL_UserList::getMenu('search'));
if (!OW::getUser()->isAuthorized('base', 'search_users')) {
$status = BOL_AuthorizationService::getInstance()->getActionStatus('base', 'search_users');
$this->assign('authMessage', $status['msg']);
return;
}
$mainSearchForm = OW::getClassInstance('MainSearchForm', $this);
$mainSearchForm->process($_POST);
$this->addForm($mainSearchForm);
$displayNameSearchForm = new DisplayNameSearchForm($this);
$displayNameSearchForm->process($_POST);
$this->addForm($displayNameSearchForm);
}
示例14: collectItems
public function collectItems(BASE_CLASS_ConsoleItemCollector $event)
{
$language = OW::getLanguage();
$router = OW::getRouter();
if (OW::getUser()->isAuthenticated()) {
// Admin menu
if (OW::getUser()->isAdmin()) {
$item = new BASE_CMP_ConsoleDropdownMenu($language->text('admin', 'main_menu_admin'));
$item->setUrl($router->urlForRoute('admin_default'));
$item->addItem('head', array('label' => $language->text('admin', 'console_item_admin_dashboard'), 'url' => $router->urlForRoute('admin_default')));
$item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_theme'), 'url' => $router->urlForRoute('admin_themes_edit')));
$item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_users'), 'url' => $router->urlForRoute('admin_users_browse')));
$item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_pages'), 'url' => $router->urlForRoute('admin_pages_main')));
$item->addItem('main', array('label' => $language->text('admin', 'console_item_manage_plugins'), 'url' => $router->urlForRoute('admin_plugins_installed')));
$event->addItem($item, 1);
}
/**
* My Profile Menu
*
* @var $item BASE_CMP_MyProfileConsoleItem
*/
$item = OW::getClassInstance("BASE_CMP_MyProfileConsoleItem");
$event->addItem($item, 2);
} else {
$buttonListEvent = new BASE_CLASS_EventCollector(BASE_CMP_ConnectButtonList::HOOK_REMOTE_AUTH_BUTTON_LIST);
OW::getEventManager()->trigger($buttonListEvent);
$buttonList = $buttonListEvent->getData();
$iconListMarkup = '';
foreach ($buttonList as $button) {
$iconListMarkup .= '<span class="ow_ico_signin ' . $button['iconClass'] . '"></span>';
}
$cmp = new BASE_CMP_SignIn(true);
$signInMarkup = '<div style="display:none"><div id="base_cmp_floatbox_ajax_signin">' . $cmp->render() . '</div></div>';
$item = new BASE_CMP_ConsoleItem();
$item->setControl($signInMarkup . '<span class="ow_signin_label' . (empty($buttonList) ? '' : ' ow_signin_delimiter') . '">' . $language->text('base', 'sign_in_submit_label') . '</span>' . $iconListMarkup);
$event->addItem($item, 2);
OW::getDocument()->addOnloadScript("\n \$('#" . $item->getUniqId() . "').click(function(){new OW_FloatBox({ \$contents: \$('#base_cmp_floatbox_ajax_signin')});});\n ");
$item = new BASE_CMP_ConsoleButton($language->text('base', 'console_item_sign_up_label'), OW::getRouter()->urlForRoute('base_join'));
$event->addItem($item, 1);
}
$item = new BASE_CMP_ConsoleSwitchLanguage();
$event->addItem($item, 0);
}
示例15: index
/**
* Default action. Rules tab
*/
public function index($params)
{
$userId = OW::getUser()->getId();
if (OW::getRequest()->isAjax()) {
exit;
}
if (!OW::getUser()->isAuthenticated() || $userId === null) {
throw new AuthenticateException();
}
$language = OW::getLanguage();
$this->setPageHeading($language->text('base', 'users_browse_page_heading'));
$this->setPageHeadingIconClass('ow_ic_chat');
$this->setPageTitle($language->text('matchmaking', 'matches_index'));
$page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
$perPage = (int) OW::getConfig()->getValue('base', 'users_on_page');
$first = ($page - 1) * $perPage;
$count = $perPage;
$dtoList = $this->service->findMatchList($userId, $first, $count, $params['sortOrder']);
$listCount = $this->service->findMatchCount($userId);
$userService = BOL_UserService::getInstance();
$idList = array();
$compatibilityList = array();
foreach ($dtoList as $id => $item) {
$idList[] = (int) $item['id'];
$compatibilityList[$item['id']] = $this->service->getCompatibilityByValue($item['compatibility']);
}
$userDataList = array();
$fields = $this->service->getFieldsForMatchList($idList);
foreach ($idList as $userId) {
$userDataList[$userId] = array('info_gender' => !empty($fields[$userId]) ? $fields[$userId] : '', 'compatibility' => !empty($compatibilityList[$userId]) ? OW::getLanguage()->text('matchmaking', 'compatibility') . ': <span class="ow_txt_value">' . $compatibilityList[$userId] . '%</span>' : '');
}
$listCmp = OW::getClassInstance('BASE_CMP_Users', $userDataList, array(), $listCount);
$listCmp->setDisplayActivity(false);
$this->addComponent('listCmp', $listCmp);
$sortControl = new BASE_CMP_SortControl();
$sortControl->addItem('newest', OW::getLanguage()->text('matchmaking', 'newest_first'), OW::getRouter()->urlForRoute('matchmaking_members_page_sorted', array('sortOrder' => 'newest')));
$sortControl->addItem('compatible', OW::getLanguage()->text('matchmaking', 'most_compatible_first'), OW::getRouter()->urlForRoute('matchmaking_members_page_sorted', array('sortOrder' => 'compatible')));
$sortControl->setActive($params['sortOrder']);
$this->addComponent('sortControl', $sortControl);
$this->addComponent('paging', new BASE_CMP_Paging($page, ceil($listCount / $perPage), 5));
}