예제 #1
0
 public static function getInfoBySID($gateway_sid)
 {
     $gateway_info = parent::getObjectInfoBySID('payment_gateways', $gateway_sid);
     $gateway = SJB_PaymentGatewayManager::createObjectByID($gateway_info['id'], $gateway_info);
     $gateway_info['template'] = $gateway->getTemplate();
     return $gateway_info;
 }
예제 #2
0
 function _getFoundObjects($noValidCN = false)
 {
     $found_objects = array();
     $common_count = count($this->criteria['common']);
     foreach ($this->objects_info as $object_info) {
         if (!isset($object_info['count'])) {
             $object_info['count'] = $common_count;
         }
         if ($noValidCN || !$noValidCN && ($this->valid_criterion_number == 0 || $object_info['count'] == $this->valid_criterion_number)) {
             $found_object = $this->object_manager->getObjectBySID($object_info['object_sid']);
             $found_objects[$found_object->getSID()] = $found_object;
             $this->found_object_sids[] = $found_object->getSID();
         }
     }
     return $found_objects;
 }
예제 #3
0
 public static function getObjectInfo($object)
 {
     $object_info = array();
     $properties = $object->details->getProperties();
     foreach ($properties as $property) {
         $object_info['user_defined'][$property->getID()] = $property->getValue();
     }
     $system_object_info = SJB_ObjectManager::getSystemObjectInfo($object);
     $object_info['system'] = $system_object_info;
     $object_info['system']['id'] = $object->getID();
     return $object_info;
 }
예제 #4
0
 public static function getInvoiceInfoBySID($invoiceSID)
 {
     $invoice_info = parent::getObjectInfoBySID('invoices', $invoiceSID);
     if (!empty($invoice_info['serialized_items_info'])) {
         $serialized_items_info = unserialize($invoice_info['serialized_items_info']);
         $invoice_info = array_merge($invoice_info, $serialized_items_info);
     }
     if (!empty($invoice_info['serialized_tax_info'])) {
         $serialized_tax_info = unserialize($invoice_info['serialized_tax_info']);
         $invoice_info = array_merge($invoice_info, $serialized_tax_info);
     }
     return $invoice_info;
 }
예제 #5
0
 /**
  * Create structure for templates
  * 
  * @param SJB_NewsArticle $article
  * @return array:
  */
 public static function createTemplateStructureForNewsArticle($article)
 {
     $articleInfo = parent::getObjectInfo($article);
     if (is_null(self::$uploadFileManager)) {
         self::$uploadFileManager = new SJB_UploadFileManager();
     }
     foreach ($article->getProperties() as $property) {
         if ($property->isComplex()) {
             $isPropertyEmpty = true;
             $properties = $property->type->complex->getProperties();
             $properties = is_array($properties) ? $properties : array();
             foreach ($properties as $subProperty) {
                 if (!empty($articleInfo['user_defined'][$property->getID()][$subProperty->getID()]) && is_array($articleInfo['user_defined'][$property->getID()][$subProperty->getID()])) {
                     foreach ($articleInfo['user_defined'][$property->getID()][$subProperty->getID()] as $subValue) {
                         if (!empty($subValue)) {
                             $isPropertyEmpty = false;
                         }
                     }
                 }
             }
             if ($isPropertyEmpty) {
                 $articleInfo['user_defined'][$property->getID()] = '';
             }
         }
     }
     $structure = array('sid' => $articleInfo['system']['id'], 'id' => $articleInfo['system']['id'], 'date' => $articleInfo['system']['date'], 'expiration_date' => $articleInfo['system']['expiration_date'], 'active' => $articleInfo['system']['active'], 'image_link' => self::$uploadFileManager->getUploadedFileLink($articleInfo['system']['image']));
     if (!empty($articleInfo['system']['subuser_sid'])) {
         $structure['subuser'] = SJB_UserManager::getUserInfoBySID($articleInfo['system']['subuser_sid']);
     }
     $structure['METADATA'] = array('date' => array('type' => 'date'), 'expiration_date' => array('type' => 'date'));
     $structure = array_merge($structure, $articleInfo['user_defined']);
     $structure['METADATA'] = array_merge($structure['METADATA'], parent::getObjectMetaData($article));
     return array_merge($structure, $articleInfo['user_defined']);
 }
예제 #6
0
 public static function createMetadataForListing($listing, $user)
 {
     $structure['METADATA'] = array('activation_date' => array('type' => 'date'), 'expiration_date' => array('type' => 'date'), 'views' => array('type' => 'integer'), 'number_of_pictures' => array('type' => 'integer'), 'approveStatus' => array('type' => 'string'), 'rejectReason' => array('type' => 'string'));
     $structure['METADATA'] = array_merge($structure['METADATA'], parent::getObjectMetaData($listing));
     $listing_user_meta_data = array('group' => array('caption' => array('type' => 'string', 'propertyID' => 'caption')), 'registration_date' => array('type' => 'date'));
     $listing_user_meta_data = array_merge($listing_user_meta_data, parent::getObjectMetaData($user));
     $listing_product_meta_data = array('caption' => array('type' => 'string', 'propertyID' => 'caption'), 'description' => array('type' => 'text', 'propertyID' => 'short_description'));
     $listing_type_meta_data = array('caption' => array('type' => 'string', 'propertyID' => 'listing_type'));
     $structure['METADATA'] = array_merge($structure['METADATA'], array('user' => $listing_user_meta_data, 'product' => $listing_product_meta_data, 'type' => $listing_type_meta_data));
     return $structure['METADATA'];
 }
예제 #7
0
 public static function getTransactionInfoBySID($trans_sid)
 {
     $trans_info = parent::getObjectInfoBySID('transactions', $trans_sid);
     return $trans_info;
 }
예제 #8
0
 /**
  * 
  * @param SJB_User $user
  */
 public static function createTemplateStructureForUser($user)
 {
     if (!$user) {
         return array();
     }
     $structure = $user->getUserInfo();
     if (SJB_MemoryCache::has('userGroupInfo' . $user->getUserGroupSID())) {
         $user_group_info = SJB_MemoryCache::get('userGroupInfo' . $user->getUserGroupSID());
     } else {
         $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user->getUserGroupSID());
         SJB_MemoryCache::set('userGroupInfo' . $user->getUserGroupSID(), $user_group_info);
     }
     foreach ($user->getProperties() as $property) {
         $value = $property->getValue();
         if ($property->getType() == 'list') {
             $listValues = isset($property->type->property_info['list_values']) ? $property->type->property_info['list_values'] : array();
             foreach ($listValues as $listValue) {
                 if ($listValue['id'] == $value) {
                     $structure[$property->getID()] = $listValue['caption'];
                 }
             }
         } elseif ($property->getType() == 'location') {
             foreach ($property->type->fields as $locationField) {
                 if (isset($structure[$property->getID()]) && array_key_exists($locationField['id'], $structure[$property->getID()])) {
                     if ($locationField['id'] == 'State') {
                         $displayAs = !empty($locationField['display_as']) ? $locationField['display_as'] : 'state_name';
                         $listValues = SJB_StatesManager::getStateNamesBySid($property->value['State'], $displayAs);
                     } else {
                         $listValues = isset($locationField['list_values']) ? $locationField['list_values'] : array();
                     }
                     foreach ($listValues as $listValue) {
                         if ($listValue['id'] == $value[$locationField['id']]) {
                             $structure[$property->getID()][$locationField['id']] = $listValue['caption'];
                             $structure[$property->getID()][$locationField['id'] . '_Code'] = $listValue['Code'];
                             $structure[$property->getID()][$locationField['id'] . '_Name'] = $listValue['Name'];
                         }
                     }
                 }
             }
         } else {
             $structure[$property->getID()] = $value;
         }
     }
     $structure['id'] = $user->getID();
     $structure['isJobg8'] = strpos($structure['username'], 'jobg8_') !== false;
     $structure['group'] = array('id' => $user_group_info['id'], 'caption' => $user_group_info['name']);
     $subuserInfo = $user->getSubuserInfo();
     if (!empty($subuserInfo)) {
         $structure['subuser'] = $subuserInfo;
     }
     $structure['METADATA'] = array('group' => array('caption' => array('type' => 'string', 'propertyID' => 'caption')), 'registration_date' => array('type' => 'date'));
     $structure['METADATA'] = array_merge($structure['METADATA'], parent::getObjectMetaData($user));
     return $structure;
 }
예제 #9
0
파일: User.php 프로젝트: Maxlander/shixi
 function getTrialProductSIDByUserSID()
 {
     $ids = SJB_ObjectManager::getSystemPropertyValueByObjectSID('users', $this->getID(), 'trial');
     if (empty($ids)) {
         return array();
     }
     $ids = explode(',', $ids);
     $trialProducts = array();
     $products = SJB_ProductsManager::getAllProductsInfo();
     foreach ($products as $product) {
         if ($product['trial'] == 1 && $product['user_group_sid'] == $this->getUserGroupSID() && in_array($product['sid'], $ids)) {
             $trialProducts[] = $product['sid'];
         }
     }
     return $trialProducts;
 }
예제 #10
0
 public static function deleteTaxBySID($sid)
 {
     parent::deleteObject('taxes', $sid);
 }
예제 #11
0
 public static function getGuestAlertInfoBySID($sid)
 {
     return parent::getObjectInfoBySID(self::DB_TABLE_NAME, $sid);
 }
예제 #12
0
 public static function deleteCodeBySID($sid)
 {
     parent::deleteObject('promotions', $sid);
 }