当前位置: 首页>>代码示例>>PHP>>正文


PHP SJB_UserManager::getUserInfoBySID方法代码示例

本文整理汇总了PHP中SJB_UserManager::getUserInfoBySID方法的典型用法代码示例。如果您正苦于以下问题:PHP SJB_UserManager::getUserInfoBySID方法的具体用法?PHP SJB_UserManager::getUserInfoBySID怎么用?PHP SJB_UserManager::getUserInfoBySID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SJB_UserManager的用法示例。


在下文中一共展示了SJB_UserManager::getUserInfoBySID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $user = SJB_UserManager::getUserInfoBySID(SJB_Request::getVar('user_sid', 0, SJB_Request::METHOD_GET));
     $user_id = $user['sid'];
     if (SJB_Request::getVar('pm_action', '', SJB_Request::METHOD_POST) == 'delete') {
         $checked = SJB_Request::getVar('pm_check', array(), SJB_Request::METHOD_POST);
         SJB_PrivateMessage::delete($checked);
     }
     $page = intval(SJB_Request::getVar('page', 1, SJB_Request::METHOD_GET));
     $per_page = 10;
     $total = SJB_PrivateMessage::getTotalOutbox($user_id);
     $max_pages = ceil($total / $per_page);
     if ($max_pages == 0) {
         $max_pages = 1;
     }
     if ($max_pages < $page) {
         SJB_HelperFunctions::redirect("?user_sid={$user_id}&page={$max_pages}");
     }
     $navigate = SJB_PrivateMessage::getNavigate($page, $total, $per_page);
     $list = SJB_PrivateMessage::getListOutbox($user_id, $page, $per_page);
     $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($user['user_group_sid']);
     SJB_System::setGlobalTemplateVariable('wikiExtraParam', $userGroupInfo['id']);
     $tp->assign("user_group_info", $userGroupInfo);
     $tp->assign('username', $user['username']);
     $tp->assign('user_sid', $user_id);
     $tp->assign('message', $list);
     $tp->assign('navigate', $navigate);
     $tp->assign('page', $page);
     $tp->display('pm_outbox.tpl');
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:31,代码来源:pm_outbox.php

示例2: saveInvoice

 public static function saveInvoice($invoice)
 {
     $serializedItemsDetails['items'] = $invoice->getPropertyValue('items');
     $products = isset($serializedItemsDetails['items']['products']) ? $serializedItemsDetails['items']['products'] : array();
     $products = implode(',', $products);
     $invoice->addProperty(array('id' => 'serialized_items_info', 'type' => 'text', 'value' => serialize($serializedItemsDetails), 'is_system' => true));
     $invoice->addProperty(array('id' => 'product_sid', 'type' => 'string', 'value' => $products, 'is_system' => true));
     $invoice->deleteProperty('items');
     $serializedTaxDetails['tax_info'] = $invoice->getPropertyValue('tax_info');
     $invoice->addProperty(array('id' => 'serialized_tax_info', 'type' => 'text', 'value' => serialize($serializedTaxDetails), 'is_system' => true));
     $invoice->deleteProperty('tax_info');
     $user_sid = $invoice->getPropertyValue('user_sid');
     $user_info = SJB_UserManager::getUserInfoBySID($user_sid);
     if (!empty($user_info['parent_sid'])) {
         $invoice->setPropertyValue('subuser_sid', $user_sid);
         $invoice->setPropertyValue('user_sid', $user_info['parent_sid']);
     }
     $dateProperty = $invoice->getProperty('date');
     $value = $dateProperty->getValue();
     if (!$dateProperty->type->getConvertToDBDate() && $value != null) {
         $invoice->setPropertyValue('date', SJB_I18N::getInstance()->getDate($value));
     }
     $invoice->setPropertyValue('sub_total', SJB_I18N::getInstance()->getFloat($invoice->getPropertyValue('sub_total')));
     $invoice->setPropertyValue('total', SJB_I18N::getInstance()->getFloat($invoice->getPropertyValue('total')));
     parent::saveObject('invoices', $invoice);
     if ($value == null) {
         SJB_DB::query('UPDATE `invoices` SET `date`= NOW() WHERE `sid`=?n', $invoice->getSID());
     }
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:29,代码来源:InvoiceManager.php

示例3: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $user = SJB_UserManager::getUserInfoBySID(SJB_Request::getVar('user_sid'));
     $user_id = $user['sid'];
     $total_in = SJB_PrivateMessage::getTotalInbox($user_id);
     $total_out = SJB_PrivateMessage::getTotalOutbox($user_id);
     $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($user['user_group_sid']);
     SJB_System::setGlobalTemplateVariable('wikiExtraParam', $userGroupInfo['id']);
     $tp->assign('username', $user['username']);
     $tp->assign("user_group_info", $userGroupInfo);
     $tp->assign('user_sid', $user_id);
     $tp->assign('total_in', $total_in);
     $tp->assign('total_out', $total_out);
     $tp->display('main.tpl');
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:16,代码来源:pm.php

示例4: saveInDB

 function saveInDB()
 {
     $result = SJB_ContractSQL::insert($this->_getHashedFields());
     if ($result) {
         if (!$this->id) {
             $this->id = $result;
         }
         SJB_ContractSQL::updateContractExtraInfoByProductSID($this);
         if ($this->status == 'active') {
             SJB_Acl::copyPermissions($this->product_sid, $this->id, $this->number_of_listings);
         } else {
             SJB_Acl::clearPermissions('contract', $this->id);
         }
         $userInfo = SJB_UserManager::getUserInfoBySID($this->user_sid);
         $user = new SJB_User($userInfo, $userInfo['user_group_sid']);
         $user->updateSubscribeOnceUsersProperties($this->product_sid, $this->user_sid);
     }
     return (bool) $result;
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:19,代码来源:Contract.php

示例5: execute

 public function execute()
 {
     $access_type = SJB_Request::getVar('access_type');
     $listing_id = SJB_Request::getVar('listing_id');
     $user_group_id = SJB_Request::getVar('user_group_id');
     $employersGroupSID = SJB_UserGroupManager::getUserGroupSIDByID($user_group_id);
     $employersSIDs = SJB_UserManager::getUserSIDsByUserGroupSID($employersGroupSID);
     $employers = array();
     foreach ($employersSIDs as $emp) {
         $currEmp = SJB_UserManager::getUserInfoBySID($emp);
         if (isset($currEmp['CompanyName']) && $currEmp['CompanyName'] != '') {
             $employers[] = array('name' => $currEmp['CompanyName'], 'sid' => $emp);
         }
     }
     sort($employers);
     $tp = SJB_System::getTemplateProcessor();
     $listing_access_list = SJB_ListingManager::getListingAccessList($listing_id, $access_type);
     $tp->assign('listing_access_list', $listing_access_list);
     $tp->assign('employers', $employers);
     $tp->display('employers_list.tpl');
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:21,代码来源:employers_list.php

示例6: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $action = SJB_Request::getVar('action', '', SJB_Request::METHOD_GET);
     $mess_id = intval(SJB_Request::getVar('mess', 0, SJB_Request::METHOD_GET));
     $return_to = SJB_Request::getVar('from', 'in', SJB_Request::METHOD_GET);
     $page = intval(SJB_Request::getVar('page', 1, SJB_Request::METHOD_GET));
     $user = SJB_UserManager::getUserInfoBySID(SJB_Request::getVar('user_sid'));
     $user_id = $user['sid'];
     if ($action == 'delete') {
         SJB_DB::query("DELETE FROM `private_message` WHERE `id` = '{$mess_id}'");
         $per_page = 10;
         if ($return_to == 'in') {
             $total = SJB_PrivateMessage::getTotalInbox($user_id);
         } else {
             $total = SJB_PrivateMessage::getTotalOutbox($user_id);
         }
         $max_pages = ceil($total / $per_page);
         if ($max_pages == 0) {
             $max_pages = 1;
         }
         if ($max_pages < $page) {
             $page = $max_pages;
         }
         $site_url = SJB_System::getSystemSettings('SITE_URL');
         SJB_HelperFunctions::redirect($site_url . '/private-messages/pm-' . ($return_to == 'in' ? 'inbox' : 'outbox') . "/?user_sid={$user_id}&page={$page}");
     }
     $message = SJB_PrivateMessage::ReadMessage($mess_id, true);
     $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($user['user_group_sid']);
     SJB_System::setGlobalTemplateVariable('wikiExtraParam', $userGroupInfo['id']);
     $tp->assign("user_group_info", $userGroupInfo);
     $tp->assign('returt_to', $return_to);
     $tp->assign('username', $user['username']);
     $tp->assign('user_sid', $user_id);
     $tp->assign('message', $message);
     $tp->assign('page', $page);
     $tp->display('pm_read.tpl');
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:38,代码来源:pm_read.php

示例7: saveListing

 /**
  * @param  $listing SJB_Listing
  * @return array|bool
  */
 public static function saveListing($listing, $listingSidsForCopy = array())
 {
     $listing_type_sid = $listing->getListingTypeSID();
     if (!is_null($listing_type_sid)) {
         $keywords = SJB_ListingDBManager::getListingKeywordsArray($listing);
         // Строчку в низ не переносить, так как после сохранения объекта вытащить кейворды сложнее
         parent::saveObject('listings', $listing, false, $listingSidsForCopy);
         $user_info = SJB_UserManager::getUserInfoBySID($listing->getUserSID());
         $user_keywords = SJB_ListingDBManager::getUserKeywords($user_info);
         if ($user_keywords) {
             $keywords[] = $user_keywords;
         }
         SJB_Cache::getInstance()->clean('matchingAnyTag', array(SJB_Cache::TAG_LISTINGS));
         foreach ($keywords as $keyword) {
             SJB_ListingDBManager::saveListingKeyword($keyword, $listing->getSID(), $listing->isActive());
         }
         if (!SJB_ListingManager::hasListingProduct($listing->getSID())) {
             SJB_ListingManager::insertProduct($listing->getSID(), $listing->getProductInfo());
         }
         return SJB_DB::query('UPDATE `?w` SET `listing_type_sid` = ?n, `user_sid` = ?n, `keywords` = ?s, ' . '`activation_date` = ' . ($listing->getActivationDate() == null ? 'NOW()' : "'{$listing->getActivationDate()}'") . ' WHERE `sid` = ?n', 'listings', $listing_type_sid, $listing->getUserSID(), $listing->getKeywords(), $listing->getSID());
     }
     return false;
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:27,代码来源:ListingDBManager.php

示例8: generateExportData

 public static function generateExportData($parameters)
 {
     $exportProperties = $aliases = $sid = null;
     extract($parameters);
     $exportData = array();
     $userInfo = SJB_UserManager::getUserInfoBySID($sid);
     $userInfo['id'] = $userInfo['sid'];
     $userInfo = $aliases->changePropertiesInfo($userInfo);
     if (!empty($userInfo['product'])) {
         $contracts = $userInfo['product'];
         $userInfo['product'] = array();
         foreach ($contracts as $contract) {
             $productInfo = SJB_ProductsManager::getProductInfoBySID($contract['product_sid']);
             if ($productInfo) {
                 $extraInfo = !empty($contract['serialized_extra_info']) ? unserialize($contract['serialized_extra_info']) : null;
                 $userInfo['product'][] = serialize(array('name' => $productInfo['name'], 'creation_date' => $contract['creation_date'], 'expired_date' => $contract['expired_date'], 'price' => $contract['price'], 'number_of_postings' => $contract['number_of_postings'], 'number_of_listings' => $extraInfo ? $extraInfo['number_of_listings'] : 0, 'status' => $contract['status']));
             }
         }
         $userInfo['product'] = implode(',', $userInfo['product']);
     } else {
         $userInfo['product'] = '';
     }
     // this data is necessary for additional properties : like tree
     $exportData[$sid][self::USER_OPTIONS_INDEX]['user_group_id'] = SJB_Array::get($userInfo, 'user_group');
     foreach ($exportProperties as $propertyId => $value) {
         $exportData[$sid][$propertyId] = isset($userInfo[$propertyId]) ? $userInfo[$propertyId] : null;
     }
     self::changeTreeProperties($exportData);
     self::changeListProperties($exportData);
     self::cleanOptions($exportData);
     self::changeMonetaryProperties($exportProperties, $exportData);
     self::changeFileProperties($exportProperties, $exportData, 'file');
     self::changeFileProperties($exportProperties, $exportData, 'video');
     self::changeFileProperties($exportProperties, $exportData, 'Logo');
     self::changeLocationProperties($exportProperties, $exportData);
     return $exportData[$sid];
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:37,代码来源:UsersExportController.php

示例9: execute

 public function execute()
 {
     $user_sid = isset($_REQUEST['user_sid']) ? $_REQUEST['user_sid'] : null;
     $field_id = isset($_REQUEST['field_id']) ? $_REQUEST['field_id'] : null;
     $user_info = SJB_UserManager::getUserInfoBySID($user_sid);
     if (is_null($field_id) || is_null($user_sid)) {
         $errors['PARAMETERS_MISSED'] = 1;
     } elseif (!isset($user_info[$field_id])) {
         $errors['WRONG_PARAMETERS_SPECIFIED'] = 1;
     } else {
         $uploaded_file_id = $user_info[$field_id];
         SJB_UploadFileManager::deleteUploadedFileByID($uploaded_file_id);
         $user_info[$field_id] = "";
         $user = new SJB_User($user_info, $user_info['user_group_sid']);
         $user->deleteProperty("active");
         $user->deleteProperty('password');
         $user->setSID($user_info['sid']);
         SJB_UserManager::saveUser($user);
     }
     $template_processor = SJB_System::getTemplateProcessor();
     $template_processor->assign("errors", isset($errors) ? $errors : null);
     $template_processor->assign("user_sid", $user_sid);
     $template_processor->display("delete_uploaded_picture.tpl");
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:24,代码来源:delete_uploaded_file.php

示例10: getListingAccessList

 public static function getListingAccessList($listing_id, $access_type)
 {
     $result = SJB_DB::query("SELECT `access_list` FROM `listings` WHERE `access_type` = ?s AND `sid` =?n ", $access_type, $listing_id);
     if ($result) {
         $result = array_pop($result);
         $result = explode(',', array_pop($result));
     } else {
         $result = false;
     }
     $employers = array();
     if (is_array($result)) {
         foreach ($result as $emp) {
             if (!empty($emp)) {
                 $currEmp = SJB_UserManager::getUserInfoBySID($emp);
                 $employers[] = array('user_id' => $emp, 'value' => $currEmp['CompanyName']);
             }
         }
         sort($employers);
     }
     return $employers;
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:21,代码来源:ListingManager.php

示例11: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $userSID = SJB_Request::getVar('user_sid', false);
     $includeTax = SJB_Request::getVar('include_tax', SJB_Settings::getSettingByName('enable_taxes'));
     $errors = array();
     $invoiceErrors = array();
     $template = 'add_invoice.tpl';
     $userInfo = SJB_UserManager::getUserInfoBySID($userSID);
     if ($userInfo) {
         if (!empty($userInfo['parent_sid'])) {
             $parent_sid = $userInfo['parent_sid'];
             $username = $userInfo['username'] . '/' . $userInfo['email'];
         } else {
             $parent_sid = $userSID;
             $username = $userInfo['FirstName'] . ' ' . $userInfo['LastName'] . ' ' . $userInfo['ContactName'] . ' ' . $userInfo['CompanyName'] . '/' . $userInfo['email'];
         }
         $formSubmitted = SJB_Request::getVar('action', '') == 'save';
         $productsSIDs = SJB_ProductsManager::getProductsIDsByUserGroupSID($userInfo['user_group_sid']);
         $products = array();
         foreach ($productsSIDs as $key => $productSID) {
             $productInfo = SJB_ProductsManager::getProductInfoBySID($productSID);
             if (!empty($productInfo['pricing_type']) && $productInfo['pricing_type'] == 'volume_based') {
                 $volumeBasedPricing = $productInfo['volume_based_pricing'];
                 $minListings = min($volumeBasedPricing['listings_range_from']);
                 $maxListings = max($volumeBasedPricing['listings_range_to']);
                 $countListings = array();
                 for ($i = $minListings; $i <= $maxListings; $i++) {
                     $countListings[$i]['number_of_listings'] = $i;
                     for ($j = 1; $j <= count($volumeBasedPricing['listings_range_from']); $j++) {
                         if ($i >= $volumeBasedPricing['listings_range_from'][$j] && $i <= $volumeBasedPricing['listings_range_to'][$j]) {
                             $countListings[$i]['price'] = $volumeBasedPricing['price_per_unit'][$j];
                         }
                     }
                 }
                 $productInfo['count_listings'] = $countListings;
             } elseif (!empty($productInfo['pricing_type']) && $productInfo['pricing_type'] == 'fixed') {
                 unset($productInfo['volume_based_pricing']);
             }
             $products[$key] = $productInfo;
         }
         $total = SJB_I18N::getInstance()->getInput('float', SJB_Request::getVar('total', 0));
         $taxInfo = SJB_TaxesManager::getTaxInfoByUserSidAndPrice($parent_sid, $total);
         $invoice = new SJB_Invoice($_REQUEST);
         $addForm = new SJB_Form($invoice);
         $addForm->registerTags($tp);
         if ($formSubmitted) {
             $invoiceErrors = $invoice->isValid();
             if (empty($invoiceErrors) && $addForm->isDataValid($errors)) {
                 $invoice->setFloatNumbersIntoValidFormat();
                 $invoice->setPropertyValue('success_page_url', SJB_System::getSystemSettings('USER_SITE_URL') . '/create-contract/');
                 SJB_InvoiceManager::saveInvoice($invoice);
                 if (SJB_Request::getVar('send_invoice', false)) {
                     SJB_Notifications::sendInvoiceToCustomer($invoice->getSID(), $userSID);
                 }
                 SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . '/manage-invoices/');
             } else {
                 $invoiceDate = SJB_I18N::getInstance()->getInput('date', $invoice->getPropertyValue('date'));
                 $invoice->setPropertyValue('date', $invoiceDate);
             }
         } else {
             $invoice->setPropertyValue('date', date('Y-m-d'));
             $invoice->setPropertyValue('status', SJB_Invoice::INVOICE_STATUS_UNPAID);
         }
         $invoice->setFloatNumbersIntoValidFormat();
         $tp->assign('username', $username);
         $tp->assign('user_sid', $userSID);
         $tp->assign('products', $products);
         $tp->assign('tax', $taxInfo);
         $tp->assign('include_tax', $includeTax);
     } else {
         $errors[] = 'CUSTOMER_NOT_SELECTED';
         $tp->assign('action', 'add');
         $template = 'errors.tpl';
     }
     $tp->assign("errors", array_merge($errors, $invoiceErrors));
     $tp->display($template);
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:78,代码来源:add_invoice.php

示例12: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $errors = array();
     $template = 'sub_accounts.tpl';
     $currentUserInfo = SJB_UserManager::getCurrentUserInfo();
     $listSubusers = false;
     if (!empty($currentUserInfo['subuser']) && SJB_Request::getVar('action_name') != 'edit' && SJB_Request::getVar('user_id', 0) != $currentUserInfo['subuser']['sid']) {
         $errors['ACCESS_DENIED'] = 'ACCESS_DENIED';
     }
     switch (SJB_Request::getVar('action_name')) {
         case 'new':
             $form_submitted = SJB_Request::getMethod() === SJB_Request::METHOD_POST;
             $user_group_sid = $currentUserInfo['user_group_sid'];
             $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid);
             $_REQUEST['user_group_id'] = $user_group_info['id'];
             $user = SJB_ObjectMother::createUser($_REQUEST, $user_group_sid);
             $props = $user->getProperties();
             $allowedProperties = array('username', 'email', 'password');
             foreach ($props as $prop) {
                 if (!in_array($prop->getID(), $allowedProperties)) {
                     $user->deleteProperty($prop->getID());
                 }
             }
             $registration_form = SJB_ObjectMother::createForm($user);
             $registration_form->registerTags($tp);
             if (SJB_UserGroupManager::isUserEmailAsUsernameInUserGroup($user_group_sid) && $form_submitted) {
                 $email = $user->getPropertyValue('email');
                 if (is_array($email)) {
                     $email = $email['original'];
                 }
                 $user->setPropertyValue('username', $email);
             }
             $registration_form = SJB_ObjectMother::createForm($user);
             if ($form_submitted && $registration_form->isDataValid($errors)) {
                 $user->addParentProperty($currentUserInfo['sid']);
                 $subuserPermissions = array('subuser_add_listings' => array('title' => 'Add new listings', 'value' => 'deny'), 'subuser_manage_listings' => array('title' => 'Manage listings and applications of other sub users', 'value' => 'deny'), 'subuser_manage_subscription' => array('title' => 'View and update subscription', 'value' => 'deny'), 'subuser_use_screening_questionnaires' => array('title' => 'Manage Questionnaries', 'value' => 'deny'));
                 SJB_UserManager::saveUser($user);
                 SJB_Statistics::addStatistics('addSubAccount', $user->getUserGroupSID(), $user->getSID());
                 SJB_Acl::clearPermissions('user', $user->getSID());
                 foreach ($subuserPermissions as $permissionID => $permission) {
                     $allowDeny = SJB_Request::getVar($permissionID, 'deny');
                     $subuserPermissions[$permissionID]['value'] = $allowDeny;
                     SJB_Acl::allow($permissionID, 'user', $user->getSID(), $allowDeny);
                 }
                 SJB_UserManager::activateUserByUserName($user->getUserName());
                 SJB_Notifications::sendSubuserRegistrationLetter($user, SJB_Request::get(), $subuserPermissions);
                 $tp->assign('isSubuserRegistered', true);
                 $listSubusers = true;
             } else {
                 if (SJB_UserGroupManager::isUserEmailAsUsernameInUserGroup($user_group_sid)) {
                     $user->deleteProperty("username");
                 }
                 $registration_form = SJB_ObjectMother::createForm($user);
                 if ($form_submitted) {
                     $registration_form->isDataValid($errors);
                 }
                 $registration_form->registerTags($tp);
                 $form_fields = $registration_form->getFormFieldsInfo();
                 $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid);
                 $tp->assign("user_group_info", $user_group_info);
                 $tp->assign("errors", $errors);
                 $tp->assign("form_fields", $form_fields);
                 $metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
                 $tp->assign("METADATA", array("form_fields" => $metaDataProvider->getFormFieldsMetadata($form_fields)));
                 $tp->display('subuser_registration_form.tpl');
             }
             break;
         case 'edit':
             $userInfo = SJB_UserManager::getUserInfoBySID(SJB_Request::getVar('user_id', 0));
             if (!empty($userInfo) && $userInfo['parent_sid'] === $currentUserInfo['sid']) {
                 $userInfo = array_merge($userInfo, $_REQUEST);
                 $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($currentUserInfo['user_group_sid']);
                 $user = new SJB_User($userInfo, $userInfo['user_group_sid']);
                 $user->setSID($userInfo['sid']);
                 $user->addParentProperty($currentUserInfo['sid']);
                 $props = $user->getProperties();
                 $allowedProperties = array('username', 'email', 'password');
                 foreach ($props as $prop) {
                     if (!in_array($prop->getID(), $allowedProperties)) {
                         $user->deleteProperty($prop->getID());
                     }
                 }
                 $user->makePropertyNotRequired("password");
                 $edit_profile_form = SJB_ObjectMother::createForm($user);
                 $edit_profile_form->registerTags($tp);
                 $edit_profile_form->makeDisabled("username");
                 $form_submitted = SJB_Request::getMethod() == SJB_Request::METHOD_POST;
                 if (empty($errors) && $form_submitted && $edit_profile_form->isDataValid($errors)) {
                     $password_value = $user->getPropertyValue('password');
                     if (empty($password_value['original'])) {
                         $user->deleteProperty('password');
                     }
                     $currentUser = SJB_UserManager::getCurrentUser();
                     if (!$currentUser->isSubuser()) {
                         $subuserPermissions = array('subuser_add_listings', 'subuser_manage_listings', 'subuser_manage_subscription', 'subuser_use_screening_questionnaires');
                         SJB_Acl::clearPermissions('user', $user->getSID());
                         foreach ($subuserPermissions as $permission) {
                             SJB_Acl::allow($permission, 'user', $user->getSID(), SJB_Request::getVar($permission, 'deny'));
                         }
//.........这里部分代码省略.........
开发者ID:Maxlander,项目名称:shixi,代码行数:101,代码来源:sub_accounts.php

示例13: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $displayForm = new SJB_Form();
     $displayForm->registerTags($tp);
     $invoiceSid = SJB_Request::getVar('sid', false);
     if (SJB_Request::getVar('error', false)) {
         SJB_FlashMessages::getInstance()->addWarning('TCPDF_ERROR');
     }
     $action = SJB_Request::getVar('action', false);
     $paymentGateway = SJB_Request::getVar('payment_gateway', false);
     $template = 'print_invoice.tpl';
     $currentUserSID = SJB_UserManager::getCurrentUserSID();
     $invoiceInfo = SJB_InvoiceManager::getInvoiceInfoBySID($invoiceSid);
     if ($invoiceInfo) {
         if ($currentUserSID == $invoiceInfo['user_sid']) {
             $taxInfo = SJB_TaxesManager::getTaxInfoBySID($invoiceInfo['tax_info']['sid']);
             $invoiceInfo = array_merge($invoiceInfo, $_REQUEST);
             if (is_array($taxInfo)) {
                 $taxInfo = array_merge($invoiceInfo['tax_info'], $taxInfo);
             } else {
                 $taxInfo = $invoiceInfo['tax_info'];
             }
             $invoice = new SJB_Invoice($invoiceInfo);
             $invoice->setSID($invoiceSid);
             $userInfo = SJB_UserManager::getUserInfoBySID($currentUserSID);
             $username = $userInfo['CompanyName'] . ' ' . $userInfo['FirstName'] . ' ' . $userInfo['LastName'];
             $user = SJB_UserManager::getObjectBySID($currentUserSID);
             $productsSIDs = SJB_ProductsManager::getProductsIDsByUserGroupSID($userInfo['user_group_sid']);
             $products = array();
             foreach ($productsSIDs as $key => $productSID) {
                 $product = SJB_ProductsManager::getProductInfoBySID($productSID);
                 $products[$key] = $product;
             }
             $displayForm = new SJB_Form($invoice);
             $displayForm->registerTags($tp);
             $show = true;
             if ($action == 'download_pdf_version' || $action == 'print') {
                 $show = false;
             }
             $tp->assign('show', $show);
             $tp->assign('products', $products);
             $tp->assign('invoice_sid', $invoiceSid);
             $tp->assign('invoice_status', $invoiceInfo['status']);
             $tp->assign('username', trim($username));
             $tp->assign('user_sid', $currentUserSID);
             $tp->assign('tax', $taxInfo);
             $userStructure = SJB_UserManager::createTemplateStructureForUser($user);
             $tp->assign('user', $userStructure);
             $tp->assign('include_tax', $invoiceInfo['include_tax']);
             if ($action == 'download_pdf_version') {
                 $template = 'invoice_to_pdf.tpl';
                 $filename = 'invoice_' . $invoiceSid . '.pdf';
                 try {
                     SJB_HelperFunctions::html2pdf($tp->fetch($template), $filename);
                     exit;
                 } catch (Exception $e) {
                     SJB_Error::writeToLog($e->getMessage());
                     SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . '/print-invoice/?sid=' . $invoiceSid . '&action=print&error=TCPDF_ERROR');
                 }
             }
         } else {
             SJB_FlashMessages::getInstance()->addError('NOT_OWNER');
         }
     } else {
         SJB_FlashMessages::getInstance()->addError('WRONG_INVOICE_ID_SPECIFIED');
     }
     if ($paymentGateway) {
         $gatewaySID = SJB_PaymentGatewayManager::getSIDByID($paymentGateway);
         $gatewayInfo = SJB_PaymentGatewayManager::getInfoBySID($gatewaySID);
         $tp->assign('gatewayInfo', $gatewayInfo);
     }
     $tp->assign('paymentError', SJB_Request::getVar('payment_error', false));
     $tp->display($template);
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:75,代码来源:view_invoice.php

示例14: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $listingTypeID = SJB_Request::getVar('listing_type_id', null);
     $listingTypeSID = SJB_ListingTypeManager::getListingTypeSIDByID($listingTypeID);
     $listingTypeInfo = SJB_ListingTypeManager::getListingTypeInfoBySID($listingTypeSID);
     $productSID = SJB_Request::getVar('product_sid', false);
     $editUser = SJB_Request::getVar('edit_user', false);
     $action = SJB_Request::getVar('action', false);
     $username = SJB_Request::getVar('username', false);
     $errors = array();
     if ($username && ($userSID = SJB_UserManager::getUserSIDbyUsername($username))) {
         $userInfo = SJB_UserManager::getUserInfoBySID($userSID);
         $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($userInfo['user_group_sid']);
         if (!$productSID) {
             $products = SJB_ProductsManager::getProductsInfoByUserGroupSID($userGroupInfo['sid']);
             foreach ($products as $key => $product) {
                 if (empty($product['listing_type_sid']) || $product['listing_type_sid'] != $listingTypeSID) {
                     unset($products[$key]);
                 }
             }
             if ($action == 'productVerify') {
                 $errors['PRODUCT_NOT_SELECTED'] = 1;
             }
             $tp->assign('errors', $errors);
             $tp->assign('username', $username);
             $tp->assign('products', $products);
             $tp->assign('edit_user', $editUser);
             $tp->assign('userSID', $userSID);
             $tp->assign('userGroupInfo', $userGroupInfo);
             $tp->assign('listingType', SJB_ListingTypeManager::createTemplateStructure($listingTypeInfo));
             $tp->display('select_product.tpl');
         } else {
             $form_submitted = SJB_Request::getVar('action', '') == 'add';
             $tmp_listing_id_from_request = SJB_Request::getVar('listing_id', false, 'default', 'int');
             if (!empty($tmp_listing_id_from_request)) {
                 $tmp_listing_sid = $tmp_listing_id_from_request;
             } elseif (!$tmp_listing_id_from_request) {
                 $tmp_listing_sid = time();
             }
             $productInfo = SJB_ProductsManager::getProductInfoBySID($productSID);
             $extraInfo = is_null($productInfo['serialized_extra_info']) ? null : unserialize($productInfo['serialized_extra_info']);
             if (!empty($extraInfo)) {
                 $extraInfo['product_sid'] = $productSID;
             }
             $_REQUEST['featured'] = !empty($_REQUEST['featured']) ? $_REQUEST['featured'] : $productInfo['featured'];
             $_REQUEST['priority'] = !empty($_REQUEST['priority']) ? $_REQUEST['priority'] : $productInfo['priority'];
             $listing = new SJB_Listing($_REQUEST, $listingTypeSID);
             $properties = $listing->getPropertyList();
             foreach ($properties as $property) {
                 $propertyInfo = $listing->getPropertyInfo($property);
                 $propertyInfo['user_sid'] = $userSID;
                 if ($propertyInfo['type'] == 'location') {
                     $child = $listing->getChild($property);
                     $childProperties = $child->getPropertyList();
                     foreach ($childProperties as $childProperty) {
                         $childPropertyInfo = $child->getPropertyInfo($childProperty);
                         $childPropertyInfo['user_sid'] = $userSID;
                         $child->setPropertyInfo($childProperty, $childPropertyInfo);
                     }
                 }
                 $listing->setPropertyInfo($property, $propertyInfo);
             }
             $listing->deleteProperty('status');
             $listing->deleteProperty('reject_reason');
             $access_type = $listing->getProperty('access_type');
             if ($form_submitted) {
                 if (!empty($access_type)) {
                     $listing->addProperty(array('id' => 'access_list', 'type' => 'multilist', 'value' => SJB_Request::getVar("list_emp_ids"), 'is_system' => true));
                 }
             }
             $screening_questionnaires = SJB_ScreeningQuestionnaires::getList($userSID);
             if (SJB_Acl::getInstance()->isAllowed('use_screening_questionnaires') && $screening_questionnaires) {
                 $issetQuestionnairyField = $listing->getProperty('screening_questionnaire');
                 if ($issetQuestionnairyField) {
                     $value = SJB_Request::getVar("screening_questionnaire");
                     $listing_info = $_REQUEST;
                     $value = $value ? $value : isset($listing_info['screening_questionnaire']) ? $listing_info['screening_questionnaire'] : '';
                     $listing->addProperty(array('id' => 'screening_questionnaire', 'type' => 'list', 'caption' => 'Screening Questionnaire', 'value' => $value, 'list_values' => SJB_ScreeningQuestionnaires::getListSIDsAndCaptions($userSID), 'is_system' => true));
                 }
             } else {
                 $listing->deleteProperty('screening_questionnaire');
             }
             if ($listing->getProperty('captcha')) {
                 $listing->deleteProperty('captcha');
             }
             $add_listing_form = new SJB_Form($listing);
             $add_listing_form->registerTags($tp);
             $field_errors = array();
             if ($form_submitted && $add_listing_form->isDataValid($field_errors)) {
                 $listing->addProperty(array('id' => 'complete', 'type' => 'integer', 'value' => 1, 'is_system' => true));
                 $listing->setUserSID($userSID);
                 $listing->setProductInfo($extraInfo);
                 if (empty($access_type->value)) {
                     $listing->setPropertyValue('access_type', 'everyone');
                 }
                 SJB_ListingManager::saveListing($listing);
                 SJB_Statistics::addStatistics('addListing', $listing->getListingTypeSID(), $listing->getSID(), false, $_REQUEST['featured'], $_REQUEST['priority'], $userSID);
                 if (isset($_SESSION['tmp_file_storage'])) {
                     foreach ($_SESSION['tmp_file_storage'] as $v) {
//.........这里部分代码省略.........
开发者ID:Maxlander,项目名称:shixi,代码行数:101,代码来源:add_listing.php

示例15: runTaskScheduler

    private function runTaskScheduler()
    {
        // Deactivate Expired Listings & Send Notifications
        $listingsExpiredID = SJB_ListingManager::getExpiredListingsSID();
        foreach ($listingsExpiredID as $listingExpiredID) {
            SJB_ListingManager::deactivateListingBySID($listingExpiredID, true);
            $listing = SJB_ListingManager::getObjectBySID($listingExpiredID);
            $listingInfo = SJB_ListingManager::createTemplateStructureForListing($listing);
            if (SJB_UserNotificationsManager::isUserNotifiedOnListingExpiration($listing->getUserSID())) {
                SJB_Notifications::sendUserListingExpiredLetter($listingInfo);
            }
            // notify admin
            SJB_AdminNotifications::sendAdminListingExpiredLetter($listingInfo);
        }
        $listingsDeactivatedID = array();
        if (SJB_Settings::getSettingByName('automatically_delete_expired_listings')) {
            $listingsDeactivatedID = SJB_ListingManager::getDeactivatedListingsSID();
            foreach ($listingsDeactivatedID as $listingID) {
                SJB_ListingManager::deleteListingBySID($listingID);
            }
        }
        SJB_ListingManager::unFeaturedListings();
        SJB_ListingManager::unPriorityListings();
        SJB_Cache::getInstance()->clean('matchingAnyTag', array(SJB_Cache::TAG_LISTINGS));
        /////////////////////////// Send remind notifications about expiration of LISTINGS
        // 1. get user sids and days count of 'remind listing notification' setting = 1 from user_notifications table
        // 2. foreach user:
        //   - get listings with that expiration remind date
        //   - check every listing sid in DB table of sended. If sended - remove from send list
        //   - send notification with listings to user
        //   - write listings sid in DB table of sended notifications
        $notificationData = SJB_UserNotificationsManager::getUsersAndDaysOnListingExpirationRemind();
        foreach ($notificationData as $elem) {
            $userSID = $elem['user_sid'];
            $days = $elem['days'];
            $listingSIDs = SJB_ListingManager::getListingsIDByDaysLeftToExpired($userSID, $days);
            if (empty($listingSIDs)) {
                continue;
            }
            $listingsInfo = array();
            // check listings remind sended
            foreach ($listingSIDs as $key => $sid) {
                if (SJB_ListingManager::isListingNotificationSended($sid)) {
                    unset($listingSIDs[$key]);
                    continue;
                }
                $info = SJB_ListingManager::getListingInfoBySID($sid);
                $listingsInfo[$sid] = $info;
            }
            if (!empty($listingsInfo)) {
                // now only unsended listings we have in array
                // send listing notification
                foreach ($listingSIDs as $sid) {
                    SJB_Notifications::sendRemindListingExpirationLetter($userSID, $sid, $days);
                }
                // write listing id in DB table of sended notifications
                SJB_ListingManager::saveListingIDAsSendedNotificationsTable($listingSIDs);
            }
        }
        // Send Notifications for Expired Contracts
        $contractsExpiredID = SJB_ContractManager::getExpiredContractsID();
        foreach ($contractsExpiredID as $contractExpiredID) {
            $contractInfo = SJB_ContractManager::getInfo($contractExpiredID);
            $productInfo = SJB_ProductsManager::getProductInfoBySID($contractInfo['product_sid']);
            $userInfo = SJB_UserManager::getUserInfoBySID($contractInfo['user_sid']);
            $serializedExtraInfo = unserialize($contractInfo['serialized_extra_info']);
            if (!empty($serializedExtraInfo['featured_profile']) && !empty($userInfo['featured'])) {
                $contracts = SJB_ContractManager::getAllContractsInfoByUserSID($userInfo['sid']);
                $isFeatured = 0;
                foreach ($contracts as $contract) {
                    if ($contract['id'] != $contractExpiredID) {
                        $serializedExtraInfo = unserialize($contract['serialized_extra_info']);
                        if (!empty($serializedExtraInfo['featured'])) {
                            $isFeatured = 1;
                        }
                    }
                }
                if (!$isFeatured) {
                    SJB_UserManager::removeFromFeaturedBySID($userInfo['sid']);
                }
            }
            if (SJB_UserNotificationsManager::isUserNotifiedOnContractExpiration($contractInfo['user_sid'])) {
                SJB_Notifications::sendUserContractExpiredLetter($userInfo, $contractInfo, $productInfo);
            }
            // notify admin
            SJB_AdminNotifications::sendAdminUserContractExpiredLetter($userInfo['sid'], $contractInfo, $productInfo);
            SJB_ContractManager::deleteContract($contractExpiredID, $contractInfo['user_sid']);
        }
        //////////////////////// Send remind notifications about expiration of contracts
        // 1. get user sids and days count of 'remind subscription notification' setting = 1 from user_notifications table
        // 2. foreach user:
        //   - get contracts with that expiration remind date
        //   - check every contract sid in DB table of sended. If sended - remove from send list
        //   - send notification with contracts to user
        //   - write contract sid in DB table of sended contract notifications
        $notificationData = SJB_UserNotificationsManager::getUsersAndDaysOnSubscriptionExpirationRemind();
        foreach ($notificationData as $elem) {
            $userSID = $elem['user_sid'];
            $days = $elem['days'];
            $contractSIDs = SJB_ContractManager::getContractsIDByDaysLeftToExpired($userSID, $days);
//.........这里部分代码省略.........
开发者ID:Maxlander,项目名称:shixi,代码行数:101,代码来源:task_scheduler.php


注:本文中的SJB_UserManager::getUserInfoBySID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。