예제 #1
0
파일: order.php 프로젝트: q0821/esportshop
 function manageUpload($upload_key, &$ret, $uploadConfig, $caller = '')
 {
     if (empty($ret) || empty($ret->name)) {
         return;
     }
     if (empty($upload_key)) {
         return;
     }
     if (strpos($upload_key, '-') === false) {
         return;
     }
     list($field_table, $field_namekey) = explode('-', $upload_key);
     $fieldClass = hikashop_get('class.field');
     $field = $fieldClass->getField($field_namekey, $field_table);
     if (empty($field) || $field->field_type != 'ajaxfile' && $field->field_type != 'ajaximage') {
         return;
     }
     $map = JRequest::getString('field_map', '');
     if (empty($map)) {
         return;
     }
     if ($field_table == 'item') {
         $app = JFactory::getApplication();
         $itemsData = $app->getUserState(HIKASHOP_COMPONENT . '.items_fields');
         if (empty($itemsData)) {
             $itemsData = array();
         }
         $newItem = new stdClass();
         $newItem->{$field_namekey} = $ret->name;
         $itemsData[] = $newItem;
         $app->setUserState(HIKASHOP_COMPONENT . '.items_fields', $itemsData);
     }
     if ($field_table == 'order') {
         $app = JFactory::getApplication();
         $orderData = $app->getUserState(HIKASHOP_COMPONENT . '.checkout_fields');
         if (empty($orderData)) {
             $orderData = new stdClass();
         }
         $orderData->{$field_namekey} = $ret->name;
         $app->setUserState(HIKASHOP_COMPONENT . '.checkout_fields', $orderData);
     }
     if (substr($field_table, 0, 4) == 'plg.') {
         $externalValues = array();
         JPluginHelper::importPlugin('hikashop');
         $dispatcher = JDispatcher::getInstance();
         $dispatcher->trigger('onTableFieldsLoad', array(&$externalValues));
         $found = false;
         foreach ($externalValues as $external) {
             if ($external->value == $field_table) {
                 $found = true;
                 break;
             }
         }
         if ($found) {
             $app = JFactory::getApplication();
             $elemData = $app->getUserState(HIKASHOP_COMPONENT . '.plg_fields.' . substr($field_table, 4));
             if (empty($elemData)) {
                 $elemData = array();
             }
             $newItem = new stdClass();
             $newItem->{$field_namekey} = $ret->name;
             $elemData[] = $newItem;
             $app->setUserState(HIKASHOP_COMPONENT . '.plg_fields.' . substr($field_table, 4), $elemData);
         }
     }
     if ($field->field_type == 'ajaxfile') {
         $ajaxFileClass = new hikashopAjaxfile($fieldClass);
     } else {
         $ajaxFileClass = new hikashopAjaximage($fieldClass);
     }
     $ajaxFileClass->_manageUpload($field, $ret, $map, $uploadConfig, $caller);
 }
예제 #2
0
파일: order.php 프로젝트: rodhoff/MNW
 function manageUpload($upload_key, &$ret, $uploadConfig, $caller = '')
 {
     if (empty($ret) || empty($ret->name)) {
         return;
     }
     if (empty($upload_key)) {
         return;
     }
     if (strpos($upload_key, '-') === false) {
         return;
     }
     list($field_table, $field_namekey) = explode('-', $upload_key);
     $fieldClass = hikashop_get('class.field');
     $field = $fieldClass->getField($field_namekey, $field_table);
     if (empty($field) || $field->field_type != 'ajaxfile' && $field->field_type != 'ajaximage') {
         return;
     }
     $map = JRequest::getString('field_map', '');
     if (empty($map)) {
         return;
     }
     if ($field->field_type == 'ajaxfile') {
         $ajaxFileClass = new hikashopAjaxfile($fieldClass);
     } else {
         $ajaxFileClass = new hikashopAjaximage($fieldClass);
     }
     $ajaxFileClass->_manageUpload($field, $ret, $map, $uploadConfig, $caller);
 }