Beispiel #1
0
 public function LoadMenu($params)
 {
     $oMenu = new MenuCollectionContainer();
     $locale = isset($params[self::LOCALE]) ? $params[self::LOCALE] : null;
     $szSQL = self::SELECT_FROM_JOIN(array(self::tblFldsAll(), ResDetailModel::tblFldsAll(), ResValLngStrModel::tblFld(ResValLngStrModel::VALUE) . " as " . self::LONG_STR_NAME, ResValShrtStrModel::tblFld(ResValShrtStrModel::VALUE) . " as " . self::SHORT_STR_NAME, ResValObjectModel::tblFld(ResValObjectModel::VALUE) . " as " . self::OBJ_NAME, ResValBigIntModel::tblFld(ResValBigIntModel::VALUE) . " as " . self::BIG_INT_NAME, ImageModel::tblFld(ImageModel::IMG_PATH), ResValIntModel::tblFld(ResValIntModel::VALUE) . " as " . self::SHORT_INT_NAME, ResTypeModel::TYPE, ResTypeModel::TYPE_NAME, MenuClassMapModel::tblFld(MenuClassMapModel::CLASS_NAME), MenuClassMapModel::tblFld(MenuClassMapModel::METHOD_NAME), MenuClassMapModel::tblFld(MenuClassMapModel::PARAMS)), array(self::tbl(), MenuResModel::leftJoin(array(array(self::tblFld(self::MENU_ID), MenuResModel::tblFld(MenuResModel::MENU_ID)))), ResDetailModel::leftJoin(array(array(MenuResModel::tblFld(MenuResModel::RES_ID), ResDetailModel::tblFld(ResDetailModel::RES_ID))), array(isset($locale) ? ResDetailModel::tblFld(ResDetailModel::LOCALE) : null)), ResTypeModel::leftJoin(array(array(ResDetailModel::tblFld(ResDetailModel::TYPE_ID), ResTypeModel::tblFld(ResTypeModel::TYPE_ID)))), ResValLngStrModel::leftJoin(array(array(MenuResModel::tblFld(MenuResModel::RES_ID), ResValLngStrModel::tblFld(ResValLngStrModel::RES_ID)))), ResValShrtStrModel::leftJoin(array(array(MenuResModel::tblFld(MenuResModel::RES_ID), ResValShrtStrModel::tblFld(ResValShrtStrModel::RES_ID)))), ResValObjectModel::leftJoin(array(array(MenuResModel::tblFld(MenuResModel::RES_ID), ResValObjectModel::tblFld(ResValObjectModel::RES_ID)))), ResValBigIntModel::leftJoin(array(array(MenuResModel::tblFld(MenuResModel::RES_ID), ResValBigIntModel::tblFld(ResValBigIntModel::RES_ID)))), ImageModel::leftJoin(array(array(ResValBigIntModel::tblFld(ResValBigIntModel::VALUE), ImageModel::tblFld(ImageModel::IMG_ID))), array(array(ResTypeModel::tblFld(ResTypeModel::TYPE), "='" . \Av\Component\Menu\iMenuModelInterface::TYPE_IMAGE . "'"))), ResValIntModel::leftJoin(array(array(MenuResModel::tblFld(MenuResModel::RES_ID), ResValIntModel::tblFld(ResValIntModel::RES_ID)))), MenuClassMapModel::leftJoin(array(array(self::tblFld(self::MENU_ID), MenuClassMapModel::tblFld(MenuClassMapModel::MENU_ID))))), null, array(self::tblFld(self::POS_X), self::tblFld(self::POS_Y)));
     $arrSQL = array();
     if (isset($locale)) {
         $arrSQL[] = $locale;
     }
     $cDB =& $this->GetDBAdapter();
     $rs = $cDB->Execute($szSQL, $arrSQL);
     //        $this->AddDebugAsObject($rs->sql, __METHOD__ . " SQL: line #" . __LINE__);
     if (!empty($error)) {
         //            $this->AddDebugAsObject($szSQL, __METHOD__ . " failed SQL: line #" . __LINE__);
         //            $this->AddDebugAsObject($arrSQL, __METHOD__ . " failed SQL params are: line #" . __LINE__);
         //            $this->AddDebugAsObject($error, __METHOD__ . " SQL error:  line #" . __LINE__);
         return false;
     }
     while ($this->isValid($rs)) {
         $oMenu->AddToCollection($rs->fields[self::TAG], $rs->fields[self::POS_X], $rs->fields[self::POS_Y], $rs->fields);
         $rs->MoveNext();
     }
     //        echo __METHOD__ . " #" .__LINE__ . " menus : <br><pre>" . print_r($oMenu, true) . "</pre><br>";
     return $oMenu;
 }
Beispiel #2
0
 public function GetProduct($params = null)
 {
     $arrReturnMe = array();
     if (empty($params[self::PROD_ID])) {
         return false;
     }
     $szSQL = self::SELECT_FROM_JOIN(array(self::tblFld(self::PROD_ID), self::tblFld(self::PROD_NAME), \Av\Image\ImageModel::tblFld(\Av\Image\ImageModel::IMG_PATH), \Av\Image\ImageModel::tblFld(\Av\Image\ImageModel::IMG_ID), ProductDescriptionModel::tblFld(ProductDescriptionModel::DESCRIPTION), ProductAttributeModel::ATTR_GROUP_ID, ProductAttributeModel::ATTR_ID, ProductAttributeModel::ATTR_VALUE), array(self::tbl(), ProductDescriptionModel::leftJoin(array(array(self::tblFld(self::PROD_ID), ProductDescriptionModel::tblFld(ProductDescriptionModel::PROD_ID)))), ProductImageModel::leftJoin(array(array(self::tblFld(self::PROD_ID), ProductImageModel::tblFld(ProductImageModel::PROD_ID)))), \Av\Image\ImageModel::leftJoin(array(array(ProductImageModel::tblFld(ProductImageModel::IMG_ID), \Av\Image\ImageModel::tblFld(\Av\Image\ImageModel::IMG_ID)))), ProductAttributeModel::leftJoin(array(array(self::tblFld(self::PROD_ID), ProductAttributeModel::tblFld(ProductAttributeModel::PROD_ID))), array(ProductAttributeModel::tblFld(ProductAttributeModel::STATUS)))), array(self::tblFld(self::STATUS), self::tblFld(self::PROD_ID)));
     $arrSQL = array(1, 1, $params[self::PROD_ID]);
     $cDB =& $this->GetDBAdapter();
     $rs = $cDB->Execute($szSQL, $arrSQL);
     $error = $cDB->ErrorMsg();
     $this->AddDebugAsObject($rs->sql, __METHOD__ . " line #" . __LINE__);
     if (!empty($error)) {
         $this->AddDebugAsObject($szSQL, __METHOD__ . " failed SQL: line #" . __LINE__);
         $this->AddDebugAsObject($arrSQL, __METHOD__ . " failed SQL params are: line #" . __LINE__);
         $this->AddDebugAsObject($error, __METHOD__ . " SQL error:  line #" . __LINE__);
         return false;
     }
     while ($this->isValid($rs)) {
         $this->AddRecord($arrReturnMe, $rs->fields);
         $rs->MoveNext();
     }
     return empty($arrReturnMe) ? false : $arrReturnMe;
 }