本文整理汇总了PHP中OW_Component类的典型用法代码示例。如果您正苦于以下问题:PHP OW_Component类的具体用法?PHP OW_Component怎么用?PHP OW_Component使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OW_Component类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getComponentMarkup
protected function getComponentMarkup(OW_Component $cmp)
{
/* @var $document OW_AjaxDocument */
$document = OW::getDocument();
$responce = array();
$responce['content'] = trim($cmp->render());
$beforeIncludes = $document->getScriptBeforeIncludes();
if (!empty($beforeIncludes)) {
$responce['beforeIncludes'] = $beforeIncludes;
}
foreach ($document->getScripts() as $script) {
$responce['scriptFiles'][] = $script;
}
$onloadScript = $document->getOnloadScript();
if (!empty($onloadScript)) {
$responce['onloadScript'] = $onloadScript;
}
$styleDeclarations = $document->getStyleDeclarations();
if (!empty($styleDeclarations)) {
$responce['styleDeclarations'] = $styleDeclarations;
}
$styleSheets = $document->getStyleSheets();
if (!empty($styleSheets)) {
$responce['styleSheets'] = $styleSheets;
}
return $responce;
}
示例2: __construct
public function __construct($userId)
{
parent::__construct();
$cover = UHEADER_BOL_Service::getInstance()->findCoverByUserId($userId);
if (empty($cover)) {
$this->assign('error', OW::getLanguage()->text('uheader', 'cover_not_found'));
return;
}
$src = UHEADER_BOL_Service::getInstance()->getCoverUrl($cover);
$settings = $cover->getSettings();
$height = $settings['dimensions']['height'];
$width = $settings['dimensions']['width'];
$top = 0;
if ($height < self::MIN_HEIGHT) {
$top = (self::MIN_HEIGHT - $height) / 2;
}
$avatarsData = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($userId));
$this->assign('user', $avatarsData[$userId]);
$this->assign('src', $src);
$this->assign('top', $top);
$this->assign('dimensions', $settings['dimensions']);
$cmtParams = new BASE_CommentsParams('uheader', UHEADER_CLASS_CommentsBridge::ENTITY_TYPE);
$cmtParams->setWrapInBox(false);
$cmtParams->setEntityId($cover->id);
$cmtParams->setOwnerId($userId);
$cmtParams->setDisplayType(BASE_CommentsParams::DISPLAY_TYPE_TOP_FORM_WITH_PAGING);
$photoCmts = new BASE_CMP_Comments($cmtParams);
$this->addComponent('comments', $photoCmts);
}
示例3: render
public function render()
{
$cssUrl = OW::getPluginManager()->getPlugin('FBCONNECT')->getStaticCssUrl() . 'fbconnect.css';
OW::getDocument()->addStyleSheet($cssUrl);
FBCONNECT_BOL_Service::getInstance()->initializeJs(array('email', 'user_about_me', 'user_birthday'), $_GET);
return parent::render();
}
示例4: onBeforeRender
public function onBeforeRender()
{
parent::onBeforeRender();
$userList = array();
$userDtoList = array();
$userService = BOL_UserService::getInstance();
$questionService = BOL_QuestionService::getInstance();
$userIdList = array_keys($this->userList);
$userDataList = BOL_QuestionService::getInstance()->getQuestionData($userIdList, $this->fieldList);
foreach ($userService->findUserListByIdList($userIdList) as $userDto) {
$userDtoList[$userDto->id] = $userDto;
}
foreach ($this->userList as $userId => $fieldList) {
$fields = array_diff(array_keys($fieldList), $this->fieldList);
$fieldsData = $questionService->getQuestionData(array($userId), $fields);
$userList[$userId]['fields'] = array_merge(!empty($userDataList[$userId]) ? $userDataList[$userId] : array(), !empty($fieldsData[$userId]) ? $fieldsData[$userId] : array(), $fieldList);
$userList[$userId]['dto'] = $userDtoList[$userId];
}
$this->assign('userList', $userList);
$this->assign('avatars', BOL_AvatarService::getInstance()->getAvatarsUrlList($userIdList, 2));
$this->assign('onlineList', !empty($userIdList) ? $userService->findOnlineStatusForUserList($userIdList) : array());
$this->assign('usernameList', $userService->getUserNamesForList($userIdList));
$this->assign('displaynameList', $userService->getDisplayNamesForList($userIdList));
$this->assign('displayActivity', $this->displayActivity);
}
示例5: __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()));
}
示例6: __construct
/**
* Constructor.
*
* @param BASE_CommentsParams $params
*/
public function __construct(BASE_CommentsParams $params)
{
parent::__construct();
$this->params = $params;
$this->batchData = $params->getBatchData();
$this->staticData = empty($this->batchData['_static']) ? array() : $this->batchData['_static'];
$this->batchData = isset($this->batchData[$params->getEntityType()][$params->getEntityId()]) ? $this->batchData[$params->getEntityType()][$params->getEntityId()] : array();
srand(time());
$this->id = $params->getEntityType() . $params->getEntityId() . rand(1, 10000);
$this->cmpContextId = "comments-{$this->id}";
$this->assign('cmpContext', $this->cmpContextId);
$this->assign('wrapInBox', $params->getWrapInBox());
$this->assign('topList', in_array($params->getDisplayType(), array(BASE_CommentsParams::DISPLAY_TYPE_WITH_LOAD_LIST, BASE_CommentsParams::DISPLAY_TYPE_WITH_LOAD_LIST_MINI)));
$this->assign('bottomList', $params->getDisplayType() == BASE_CommentsParams::DISPLAY_TYPE_WITH_PAGING);
$this->assign('mini', $params->getDisplayType() == BASE_CommentsParams::DISPLAY_TYPE_WITH_LOAD_LIST_MINI);
$this->isAuthorized = OW::getUser()->isAuthorized($params->getPluginKey(), 'add_comment') && $params->getAddComment();
if (!$this->isAuthorized) {
$errorMessage = $params->getErrorMessage();
if (empty($errorMessage)) {
$status = BOL_AuthorizationService::getInstance()->getActionStatus($params->getPluginKey(), 'add_comment');
$errorMessage = OW::getUser()->isAuthenticated() ? $status['msg'] : OW::getLanguage()->text('base', 'comments_add_login_message');
}
$this->assign('authErrorMessage', $errorMessage);
}
$this->initForm();
}
示例7: __construct
/**
* Constructor.
*/
public function __construct($ajax = false)
{
parent::__construct();
$form = new Form('sign-in');
$form->setAction("");
$username = new TextField('identity');
$username->setRequired(true);
$username->setHasInvitation(true);
$username->setInvitation(OW::getLanguage()->text('base', 'component_sign_in_login_invitation'));
$form->addElement($username);
$password = new PasswordField('password');
$password->setHasInvitation(true);
$password->setInvitation('password');
$password->setRequired(true);
$form->addElement($password);
$remeberMe = new CheckboxField('remember');
$remeberMe->setValue(true);
$remeberMe->setLabel(OW::getLanguage()->text('base', 'sign_in_remember_me_label'));
$form->addElement($remeberMe);
$submit = new Submit('submit');
$submit->setValue(OW::getLanguage()->text('base', 'sign_in_submit_label'));
$form->addElement($submit);
$this->addForm($form);
if ($ajax) {
$form->setAjaxResetOnSuccess(false);
$form->setAjax();
$form->setAction(OW::getRouter()->urlFor('BASE_CTRL_User', 'ajaxSignIn'));
$form->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if( data.result ){if(data.message){OW.info(data.message);}setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}');
$this->assign('forgot_url', OW::getRouter()->urlForRoute('base_forgot_password'));
}
$this->assign('joinUrl', OW::getRouter()->urlForRoute('base_join'));
}
示例8: __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);
}
示例9: __construct
public function __construct($affiliateId)
{
parent::__construct();
$service = OCSAFFILIATES_BOL_Service::getInstance();
$affiliate = $service->findAffiliateById($affiliateId);
if (!$affiliate) {
$this->setVisible(false);
return;
}
$billingService = BOL_BillingService::getInstance();
$this->assign('currency', $billingService->getActiveCurrency());
$clicksCount = $service->countClicksForAffiliate($affiliateId);
$this->assign('clicksCount', $clicksCount);
$signupCount = $service->countRegistrationsForAffiliate($affiliateId);
$this->assign('signupCount', $signupCount);
$salesCount = $service->countSalesForAffiliate($affiliateId);
$this->assign('salesCount', $salesCount);
$clicksSum = $service->getClicksSumForAffiliate($affiliateId);
$this->assign('clicksSum', $clicksSum);
$signupSum = $service->getRegistrationsSumForAffiliate($affiliateId);
$this->assign('signupSum', $signupSum);
$salesSum = $service->getSalesSumForAffiliate($affiliateId);
$this->assign('salesSum', $salesSum);
$earnings = $clicksSum + $signupSum + $salesSum;
$this->assign('earnings', $earnings);
$payouts = $service->getPayoutSum($affiliateId);
$this->assign('payouts', $payouts);
$balance = $earnings - $payouts;
$this->assign('balance', $balance);
$this->assign('affiliate', $affiliate);
}
示例10: __construct
public function __construct($list, $offset, $count)
{
parent::__construct();
$this->assign('list', $list);
$this->assign('count', $count);
$this->assign('loadMore', $count - $offset > BOL_AvatarService::AVATAR_CHANGE_GALLERY_LIMIT);
}
示例11: onBeforeRender
public function onBeforeRender()
{
parent::onBeforeRender();
$this->assign("uniqId", $this->uniqId);
$this->assign("snippets", $this->snippets);
$this->initStatic();
}
示例12: onBeforeRender
public function onBeforeRender()
{
parent::onBeforeRender();
$this->assign('uniqId', $this->uniqId);
$language = OW::getLanguage();
$this->assign('langs', array('uploadSave' => $language->text('attachments', 'attachments_upload_save_label'), 'takeSave' => $language->text('attachments', 'attachments_take_save_label'), 'cancel' => $language->text('attachments', 'attachments_cancel_label'), 'close' => $language->text('attachments', 'attachments_close_label'), 'chooseImage' => $language->text('attachments', 'attachments_choose_image_label')));
}
示例13: __construct
public function __construct($affiliateId)
{
parent::__construct();
$form = new OCSAFFILIATES_CLASS_AssignUserForm('assign_user');
$form->getElement('affiliateId')->setValue($affiliateId);
$this->addForm($form);
}
示例14: __construct
public function __construct($pluginKey, $entityType, $entityId, $ownerId)
{
parent::__construct();
$service = BOL_RateService::getInstance();
$maxRate = $service->getConfig(BOL_RateService::CONFIG_MAX_RATE);
$cmpId = uniqid();
$entityId = (int) $entityId;
$entityType = trim($entityType);
$ownerId = (int) $ownerId;
if (OW::getUser()->isAuthenticated()) {
$userRateItem = $service->findRate($entityId, $entityType, OW::getUser()->getId());
if ($userRateItem !== null) {
$userRate = $userRateItem->getScore();
} else {
$userRate = null;
}
} else {
$userRate = null;
}
$this->assign('maxRate', $maxRate);
$this->addComponent('totalScore', new BASE_CMP_TotalScore($entityId, $entityType, $maxRate));
$this->assign('cmpId', $cmpId);
$jsParamsArray = array('cmpId' => $cmpId, 'userRate' => $userRate, 'entityId' => $entityId, 'entityType' => $entityType, 'itemsCount' => $maxRate, 'respondUrl' => OW::getRouter()->urlFor('BASE_CTRL_Rate', 'updateRate'), 'ownerId' => $ownerId);
OW::getDocument()->addOnloadScript("var rate{$cmpId} = new OwRate(" . json_encode($jsParamsArray) . "); rate{$cmpId}.init();");
}
示例15: __construct
public function __construct($affiliateId, $adminMode = false)
{
parent::__construct();
$service = OCSAFFILIATES_BOL_Service::getInstance();
$affiliate = $service->findAffiliateById($affiliateId);
if (!$affiliate) {
$this->setVisible(false);
return;
}
$this->assign('affiliate', $affiliate);
$this->assign('adminMode', $adminMode);
$this->assign('creditsEnabled', OW::getPluginManager()->isPluginActive('usercredits'));
if ($adminMode) {
$this->assign('assoc', $service->getAffiliateAssocUser($affiliateId));
$script = '$("#assign-assoc").click(function(){
assignUserFloatBox = OW.ajaxFloatBox(
"OCSAFFILIATES_CMP_AssignUser",
{ affiliateId: ' . $affiliateId . ' },
{ width: 500, title: ' . json_encode(OW::getLanguage()->text('ocsaffiliates', 'assign')) . ' }
);
});
';
OW::getDocument()->addOnloadScript($script);
}
}