public function __construct($options = null) { $oModelNavigationModule = new Admin_Model_NavigationModule(); $oModelNavigationController = new Admin_Model_NavigationController(); $oModelNavigationAction = new Admin_Model_NavigationAction(); $oModelNavigationResource = new Admin_Model_NavigationResource(); $oModelNavigationPrivilege = new Admin_Model_NavigationPrivilege(); $oModelUserRole = new Admin_Model_UserRole(); $aAllModule = $oModelNavigationModule->getAll()->toArray(); if (count($aAllModule)) { foreach ($aAllModule as $aValue) { $this->_aAllModule[$aValue["id"]] = $aValue["value"]; } } $aAllController = $oModelNavigationController->getAll()->toArray(); if (count($aAllController)) { foreach ($aAllController as $aValue) { $this->_aAllController[$aValue["id"]] = $aValue["value"]; } } $aAllAction = $oModelNavigationAction->getAll()->toArray(); if (count($aAllAction)) { foreach ($aAllAction as $aValue) { $this->_aAllAction[$aValue["id"]] = $aValue["value"]; } } $aAllRosource = $oModelNavigationResource->getAll()->toArray(); if (count($aAllRosource)) { foreach ($aAllRosource as $aValue) { $this->_aAllResource[$aValue["id"]] = $aValue["value"]; } } $aAllPriviage = $oModelNavigationPrivilege->getAll()->toArray(); if (count($aAllPriviage)) { foreach ($aAllPriviage as $aValue) { $this->_aAllPrivilege[$aValue["id"]] = $aValue["value"]; } } $aAllUserRole = $oModelUserRole->getAll()->toArray(); if (count($aAllUserRole)) { foreach ($aAllUserRole as $aValue) { $this->_aAllUserRole[$aValue["id"]] = $aValue["role_name"]; } } $oModelImage = new Admin_Model_Image(); $aImage = $oModelImage->getAll()->toArray(); $this->_aAllImage[0] = "-"; if (count($aImage)) { foreach ($aImage as $nKey => $aValue) { $this->_aAllImage[$aValue["id"]] = $aValue["user_name"]; } } $this->getSiteLayout(); parent::__construct($options); }
public function __construct($options = null) { $this->_aAllLang = array("lang_pl" => "język polski", "lang_en" => "język angielski"); $oModelImage = new Admin_Model_Image(); $aImage = $oModelImage->getAll()->toArray(); $this->_aAllImage[0] = "-"; foreach ($aImage as $nKey => $aValue) { $this->_aAllImage[$aValue["id"]] = $aValue["user_name"]; } parent::__construct($options); }
public function setSettings($nImageId, $nImageType, $nElementId) { $oModelImage = new Admin_Model_Image(); if (is_numeric($nImageId)) { if ($nElementId == 0) { $nElementId = null; } if ($nImageType == 1) { $sColumnName = "image_gallery_id"; return $oModelImage->saveAddTo($nImageId, $sColumnName, $nElementId); } else { if ($nImageType == 2) { $sColumnName = "image_slider_id"; return $oModelImage->saveAddTo($nImageId, $sColumnName, $nElementId); } } return true; } return null; }
public function setSettings($nImageId, $sUserName, $sDescr) { if (is_numeric($nImageId)) { $aImageSettings = array(); $oStringLenght = new Zend_Validate_StringLength(); $oStringLenght->setMin(0); $oStringLenght->setMax(50); if ($oStringLenght->isValid($sUserName)) { $aImageSettings["user_name"] = $sUserName; } $oStringLenght->setMax(100); if ($oStringLenght->isValid($sDescr)) { $aImageSettings["descr"] = $sDescr; } $oModelImage = new Admin_Model_Image(); if ($oModelImage->saveSettings($nImageId, $aImageSettings)) { return true; } } return null; }
public function addpictureAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->getHelper("layout")->disableLayout(); $this->getFileUploadScript(); $oUploadHandler = new AppCms2_UploadHandler(); $oUserParam = new Admin_Model_UserParam(); if ($this->_request->isPost()) { $aResult = $oUploadHandler->post(); if (!isset($aResult["files"][0]->error)) { $aPostData = $this->_request->getPost(); $nUserId = (int) $aPostData["add_photo_user_id"]; $nMediaWidth = $aPostData["media_width"]; $nMediaHeight = $aPostData["media_height"]; $sUserName = $aResult["files"][0]->name; $sGenName = $aResult["files"][0]->gen_name; if (!is_dir($this->_sPath . "user_id_" . $nUserId)) { if (!mkdir($this->_sPath . "user_id_" . $nUserId, 0777)) { throw new Zend_Exception(); } } $oImagic = new AppCms2_Imagick($this->_sPath . $sUserName); if (isset($nMediaWidth) && isset($nMediaHeight)) { $oImagic->cropimage((int) $nMediaWidth, (int) $nMediaHeight, 0, 0); } $oImagic->writeImage($this->_sPath . "user_id_" . $nUserId . "/normal_" . $sGenName); $oImagic->cropThumbnailImage(70, 100); $oImagic->writeImage($this->_sPath . "user_id_" . $nUserId . "/min_" . $sGenName); $oImagic->writeImage($this->_sPath . "thumbnail/" . $sGenName); unlink($this->_sPath . $sUserName); if (file_exists($this->_sPath . $sUserName)) { throw new Zend_Exception(); } $oModelImage = new Admin_Model_Image(); $nImageId = $oModelImage->saveImage(3, null, $sGenName, $sUserName); $oUserParam->editImageUserParam($nUserId, $nImageId); } else { $sUserName = $aResult["files"][0]->name; unlink($this->_sPath . $sUserName); } $oModelImage->deleteUnused(); } exit; }
public function newAction() { $this->_helper->viewRenderer->setNoRender(true); $form = new Admin_Form_Banner2(); $obj = new Application_Entity_RunSql('Banner2'); if ($this->_request->isPost()) { $dataForm = $this->_request->getPost(); $mBannerType = new Admin_Model_BannerType(); try { $msj = array(); var_dump($dataForm); $selectedType = $this->getParam('type', ''); $bannerType = $mBannerType->findById($selectedType); if (!$form->nombre->receive()) { $msj[] = $form->getMessages(); } else { $mImage = new Admin_Model_Image(); $fileName = $form->nombre->getFileName(); if (!empty($fileName)) { $fInfo = $form->nombre->getFileInfo(); $nombre = explode('.', $fInfo['nombre']['name']); $ext = $nombre[count($nombre) - 1]; unset($nombre[count($nombre) - 1]); $nombre = implode('_', $nombre); $dataForm['nombre'] = str_replace(" ", "_", substr($nombre, 0, 30)) . '_' . Core_Utils_Utils::getRamdomChars(5) . '.' . $ext; $resize = new Core_Utils_ResizeImage($form->nombre->getFileName()); $resize->resizeImage($bannerType['anchoimg'], $bannerType['altoimg'], 'exact'); $resize->saveImage(ROOT_IMG_DINAMIC . '/banner/' . $bannerType['codproy'] . '/' . $bannerType['anchoimg'] . 'x' . $bannerType['altoimg'] . '/' . $dataForm['nombre']); } $image = array('nombre' => $data['nombre'], 'vchestado' => 1, 'vchusucrea' => $this->_identity->iduser); $dataForm['idimagen'] = $mImage->insert($image); } if (empty($dataForm['idbanner'])) { $dataForm['tmsfeccrea'] = date('Y-m-d H:i:s'); $dataForm['vchusucrea'] = $this->_identity->iduser; $obj->save = $dataForm; } else { $dataForm['tmsfecmodif'] = date('Y-m-d H:i:s'); $dataForm['vchusumodif'] = $this->_identity->iduser; //var_dump($dataForm); return; $obj->edit = $dataForm; } $this->_redirect('/admin/banner2'); } catch (Exception $e) { echo $e->getMessage(); } } else { $this->view->titulo = "Nuevo Banner"; $this->view->submit = "Grabar Banner"; $this->view->action = "/admin/banner2/new"; $form->addDecoratorCustom('forms/_formBanner2.phtml'); echo $form; } }
public function _listdata() { $menus = array(); $menuModel = new Admin_Model_Image(); $allMenus = $menuModel->listAll(); foreach ($allMenus as $menu) { $data = array(); $data['image_id'] = $menu['image_id']; $data['gallery_name'] = $menu['gallery_name']; $data['image_name'] = $menu['image_name']; $menus[] = $data; } return $menus; }