/** * @role backend */ public function doc() { $this->loadLanguageFile('backend/Settings/API'); $response = new ActionResponse(); $response->set('classes', $this->getDocInfo()); $response->set('authMethods', ModelApi::getAuthMethods($this->application)); return $response; }
public function __construct(LiveCart $application) { parent::__construct($application, 'Product', array('childSettings')); $this->addSupportedApiActionName('import'); $this->addSupportedApiActionName('search'); $this->addSupportedApiActionName('az'); $this->addSupportedApiActionName('za'); $this->addSupportedApiActionName('za'); $this->addSupportedApiActionName('specification'); }
public static function searchRideWheel($rides, $model) { $i = 1; $searchResult[] = null; foreach ($rides as $ride) { $wheel = WheelApi::getWheelById($ride->wheel_id); if ($wheel) { $wheelModel = ModelApi::getModelById($wheel->model_id); if ($model == $wheelModel->model) { $searchResult[$i++] = $ride; } } } return $searchResult; }
public function actionAllwheels() { $userId = Yii::app()->user->id; $userId = 2; $wheelDetails = array(); $allWheels = WheelApi::getWheelsByUserId($userId); $i = 0; foreach ($allWheels as $allWheel) { $wheelArray[$i++] = $allWheel->id; } $wheelImages = ImagesApi::getPrimaryImageForWheels($wheelArray); $wheelDefaultImage = ImageUtils::getDefaultImage('wheel'); if ($allWheels) { foreach ($allWheels as $wheel) { $color = ColorApi::getColorById($wheel->color_id); $make = MakeApi::getMakeById($wheel->make_id); $model = ModelApi::getModelById($wheel->model_id); $entityId = EntityApi::getIdByType('WHEEL'); $wheelRate = FeedbackApi::getRating($wheel->id, $entityId, 'WHEEL'); $wheelRides = RidesApi::getCountOfWheelRides($wheel->id); $wheelPals = WheelApi::getNoOfPalsMetByWheelId($wheel->id); $wheelEcoMiles = RidesApi::getEcoMilesDrivenByWheel($wheel->id); $wheelRidesCount = 0; $wheelNotification = RidesApi::getUpcomingWheelRides($wheel->id); if ($wheelNotification) { $wheelRidesCount = count($wheelNotification); } $wheelDetails[$wheel->id] = array('color' => $color->color, 'make' => $make->make, 'model' => $model->model, 'rate' => round($wheelRate), 'wheelRides' => $wheelRides, 'wheelPals' => $wheelPals[0]['palcnt'], 'wheelEcoMiles' => $wheelEcoMiles, 'wheelRidesCount' => $wheelRidesCount); } } $this->render('allwheels', array('allWheels' => $allWheels, 'wheelDetails' => $wheelDetails, 'wheelImages' => $wheelImages, 'wheelDefaultImage' => $wheelDefaultImage)); }
public function __construct(LiveCart $application) { parent::__construct($application, 'UserAddress', array()); $this->addSupportedApiActionName('update'); }
public function __construct(LiveCart $application) { parent::__construct($application, 'OrderedItem', array()); $this->addSupportedApiActionName('add_to_cart'); $this->addSupportedApiActionName('delete_item'); }
public function __construct(LiveCart $application) { parent::__construct($application, 'NewsPost', array()); }
private function fillResponseItem($xml, $item) { parent::fillSimpleXmlResponseItem($xml, $item); $userFieldNames = array('userGroupID', 'email', 'firstName', 'lastName', 'companyName', 'isEnabled'); $addressFieldNames = array('stateID', 'phone', 'firstName', 'lastName', 'companyName', 'phone', 'address1', 'address2', 'city', 'stateName', 'postalCode', 'countryID', 'countryName', 'fullName', 'compact'); $cartItemFieldNames = array('name', 'ID', 'productID', 'customerOrderID', 'shipmentID', 'price', 'count', 'reservedProductCount', 'dateAdded', 'isSavedForLater'); // User if (array_key_exists('User', $item)) { foreach ($userFieldNames as $fieldName) { $xml->addChild('User_' . $fieldName, isset($item['User'][$fieldName]) ? $item['User'][$fieldName] : ''); } } // Shipping and billing addresses foreach (array('ShippingAddress', 'BillingAddress') as $addressType) { if (array_key_exists($addressType, $item)) { foreach ($addressFieldNames as $fieldName) { $xml->addChild($addressType . '_' . $fieldName, isset($item[$addressType], $item[$addressType][$fieldName]) ? $item[$addressType][$fieldName] : ''); } } } // cart itmes if (array_key_exists('cartItems', $item)) { $xmlProducts = $xml->addChild('Products'); foreach ($item['cartItems'] as $cartItem) { $ci = $xmlProducts->addChild('Product'); $ci->addChild('sku', isset($cartItem['nameData'], $cartItem['nameData']['sku']) ? $cartItem['nameData']['sku'] : ''); foreach ($cartItemFieldNames as $fieldName) { $ci->addChild($fieldName, isset($cartItem[$fieldName]) ? $cartItem[$fieldName] : ''); } } } // more? }
public function __construct(LiveCart $application) { parent::__construct($application, 'DeliveryZoneCountry', array()); }
public function actionView($id) { Yii::beginProfile('view_profile'); //$session = Yii::app()->session; $wheelsImages = array(); $wheelImages = array(); $lastRide = array(); $user = UserApi::getUserById($id); if (!$user) { throw new CHttpException(404, 'The requested page does not exist.'); } $userAge = UserApi::getAge($user->dob); $userAddress = ""; if ($user->city_id) { $userAddress = DbUtils::getAddress($user->city_id); } $imageUserId = array($id); $image = ImagesApi::getPrimaryImageForUsers($imageUserId); if ($image) { $userImage = $image[$id]; } else { $userImage = ImageUtils::getDefaultImage('user'); } $userWheelDefault = ImageUtils::getDefaultImage('wheel'); $userRides = RidesApi::getCountOfUserRides($id); $userEcoMiles = RidesApi::getEcoMilesDrivenByUser($id); $userWheel = WheelApi::getWheelsCount($id); $userPalsCount = UserPalsApi::getPalsCount($id); $entityId = EntityApi::getIdByType("user"); $driverRating = round(FeedbackApi::getRating($id, $entityId, 'DRIVER')); $passengerRating = round(FeedbackApi::getRating($id, $entityId, 'PASSENGER')); $userPals = UserPalsApi::getAllPals($id); $userPalDefaultImage = ImageUtils::getDefaultImage('user'); $lastRide = RidesApi::getLastRide($id); $lastRideWheel = WheelApi::getWheelById($lastRide[0]['wheel_id']); $userWheels = WheelApi::getWheelsByUserId($id); $favoriteWheel = WheelApi::getFavouriteWheel($id); $userFeedback = FeedbackApi::getAllFeedback($id, $entityId); $favWheelDetail = ""; $wheelMake = ""; $wheelModel = ""; $wheelColor = ""; $wheelRides = ""; $wheelEcoMiles = ""; $wheelPals = ""; $wheelPalCnt = ""; if ($favoriteWheel) { $favWheelDetail = WheelApi::getWheelById($favoriteWheel[0]["wheel_id"]); $wheelMake = MakeApi::getMakeById($favWheelDetail->make_id); $wheelModel = ModelApi::getModelById($favWheelDetail->model_id); $wheelColor = ColorApi::getColorById($favWheelDetail->color_id); $wheelRides = RidesApi::getCountOfWheelRides($favWheelDetail->id); $wheelImage = ImagesApi::getPrimaryImageForWheels(array($favoriteWheel[0]["wheel_id"])); if (!$wheelImage) { $wheelImage = $userWheelDefault; } $wheelEcoMiles = RidesApi::getEcoMilesDrivenByWheel($favWheelDetail->id); $wheelPals = WheelApi::getNoOfPalsMetByWheelId($favWheelDetail->id); $wheelPalCnt = $wheelPals[0]['palcnt']; } $i = 0; if ($userFeedback) { foreach ($userFeedback as $feedback) { $fromUserProfile = UserApi::getUserById($feedback->from_user_id); $fromUserIds[$i] = $feedback->from_user_id; $userName = UserApi::getNameByUserId($fromUserProfile->id); $userFeedbackDetails[$i++] = array('from_id' => $feedback->from_user_id, 'userName' => $userName, 'feedback' => $feedback->feedback); } } $i = 0; $j = 0; $userPalList = ""; $palScrollLabel = ""; $mergeArray = array_merge($userPals, $fromUserIds); $userIdList = array_unique($mergeArray); $userImages = ImagesApi::getPrimaryImageForUsers($userIdList); $imageArrayIndex = array_keys($userImages); $imageArrayIndexSize = count($imageArrayIndex); //var_dump($userPals); // var_dump($fromUserIds);die(); if ($userPals) { foreach ($userPals as $userPal) { $userPalList[$i++] = userapi::getUserById($userPal); } } if ($userIdList) { foreach ($userIdList as $userId) { for ($j = 0; $j < $imageArrayIndexSize; $j++) { $palsImages[$userId] = ''; if ($imageArrayIndex[$j] == $userId) { $palsImages[$userId] = $userImages[$userId]; break; } } if ($palsImages[$userId] == '') { $palsImages[$userId] = $userPalDefaultImage; } } } if ($userWheels) { foreach ($userWheels as $wheel) { $wheelIds[$wheel->id] = $wheel->id; } if ($wheelIds) { $wheelImages = ImagesApi::getPrimaryImageForWheels($wheelIds); if ($wheelImages) { $imageArrayIndex = array_keys($wheelImages); $imageArrayIndexSize = count($imageArrayIndex); foreach ($wheelIds as $wheelId) { for ($j = 0; $j < $imageArrayIndexSize; $j++) { $wheelsImages[$wheelId] = ''; if ($imageArrayIndex[$j] == $wheelId) { $wheelsImages[$wheelId] = $wheelImages[$wheelId]; break; } } if ($wheelsImages[$wheelId] == '') { $wheelsImages[$wheelId] = $userWheelDefault; } } } } } /*$palCntArray=ceil($userPalsCount/3); $l=0; if($userPalsCount>2){ for($i=0;$i<$palCntArray-1;$i++){ $palScroll[$i]=array($userPalList[$l],$userPalList[$l+1],$userPalList[$l+2]); $l=$l+3; } } while($l<$userPalsCount) { $palScroll[$palCntArray-1]=array($userPalList[$l]); $l++; } $palScrollLabel=$palScroll[0]; } $k=1; if (isset($_POST['ajxbtn'])){ if($k < $palCntArray) $palScrollLabel=$palScroll[$k]; $k++; } */ $this->render('view', array('user' => $user, 'userAddress' => $userAddress, 'userPalsCount' => $userPalsCount, 'userAge' => $userAge, 'userImage' => $userImage, 'userEcoMiles' => $userEcoMiles, 'userPals' => $userPals, 'userRides' => $userRides, 'userWheel' => $userWheel, 'driverRating' => $driverRating, 'passengerRating' => $passengerRating, 'userPalList' => $userPalList, 'favWheelDetail' => $favWheelDetail, 'wheelMake' => $wheelMake, 'wheelColor' => $wheelColor, 'wheelModel' => $wheelModel, 'wheelRides' => $wheelRides, 'wheelEcoMiles' => $wheelEcoMiles, 'wheelPalCnt' => $wheelPalCnt, 'palScrolls' => $palScrollLabel, 'palImages' => $palsImages, 'userFeedbackDetails' => $userFeedbackDetails, 'wheelsImages' => $wheelsImages, 'userWheels' => $userWheels, 'wheelImage' => $wheelImage, 'lastRide' => $lastRide, 'lastRideWheel' => $lastRideWheel)); Yii::endProfile('view_profile'); }
public function __construct(LiveCart $application) { parent::__construct($application, 'User', array('preferences')); $this->addSupportedApiActionName('import'); }
public function __construct(LiveCart $application) { parent::__construct($application, 'UserApnToken', array()); $this->addSupportedApiActionName('save', 'send'); }
public function __construct(LiveCart $application) { parent::__construct($application, 'User', array('preferences')); $this->addSupportedApiActionName('import', 'do_login', 'do_register', 'email_exist'); }
public function __construct(LiveCart $application) { parent::__construct($application, 'BillingAddress', array()); }
<li><span><label for="make">Make</label></span> <?php echo $form->dropDownList($model, 'make_id', MakeApi::getAllMakes(), array('empty' => 'Select', 'class' => 'slctbox'), array('maxlength' => 255, 'size' => 60)); ?> </li> <li> <?php echo $form->error($model, 'make_id'); ?> </li> </ul> <ul> <li><span><label for="model">Model</label></span> <?php echo $form->dropDownList($model, 'model_id', ModelApi::getAllModels(), array('empty' => 'Select', 'class' => 'slctbox'), array('maxlength' => 255, 'size' => 60)); ?> </li> <li> <?php echo $form->error($model, 'model_id'); ?> </li> </ul> <ul> <li><span><label for="year">Year</label></span> <?php echo $form->textField($model, 'year', array('size' => 20, 'maxlength' => 10, 'class' => 'txtbox med')); ?> </li> <li>
public function __construct(LiveCart $application) { parent::__construct($application, "ShippingRate", array()); }
public function __construct(LiveCart $application) { parent::__construct($application, 'State', array()); }
public function __construct(LiveCart $application) { parent::__construct($application, 'Transaction', array()); $this->addSupportedApiActionName('update'); $this->addSupportedApiActionName('create'); }
public function __construct(LiveCart $application) { $this->root = Category::getRootNode(); parent::__construct($application, 'Category', array()); }
public function __construct(LiveCart $application) { parent::__construct($application, null, array()); $this->removeSupportedApiActionName('create', 'update', 'list', 'filter', 'delete'); $this->addSupportedApiActionName('set'); }
public function __construct(LiveCart $application) { parent::__construct($application, 'ProductVariation', array()); $this->addSupportedApiActionName('import'); }
public function __construct(LiveCart $application) { parent::__construct($application, 'OrderNote', array()); $this->addSupportedApiActionName('send'); }
public function __construct(LiveCart $application) { parent::__construct($application, 'ProductOption', array()); }
public function __construct(LiveCart $application) { parent::__construct($application, "Shipment", array()); $this->addSupportedApiActionName('set'); }