/** Setup index page */ public function indexAction() { $content = new Content(); $this->view->contents = $content->getFrontContent('database'); $thumbs = new Slides(); $this->view->thumbs = $thumbs->getLast10Thumbnails(4); $finds = new Finds(); $this->view->counts = $finds->getCountAllFinds(); $recent = new Logins(); $this->view->logins = $recent->todayVisitors(); $form = new SolrForm(); $form->setMethod('post'); $this->view->form = $form; $values = $form->getValues(); if ($this->getRequest()->isPost() && $form->isValid($_POST)) { if ($form->isValid($form->getValues())) { $params = array_filter($form->getValues()); $params = $this->array_cleanup($params); $this->_flashMessenger->addMessage('Your search is complete'); $this->_helper->Redirector->gotoSimple('results', 'search', 'database', $params); } else { $form->populate($data); } } }
/** View a user's account */ public function accountAction() { if ($this->_getParam('username', false)) { $users = new Users(); $this->view->users = $users->findUserAccount((string) $this->_getParam('username')); $slides = new Slides(); $this->view->images = $slides->recentFinds((string) $this->_getParam('username'), 4); } else { throw new Pas_Exception_Param('Parameter not found'); } }
/** Medieval type details page */ public function typeAction() { if ($this->_getParam('id', false)) { $types = new MedievalTypes(); $this->view->types = $types->getTypeDetails((int) $this->_getParam('id')); $images = new Slides(); $this->view->images = $images->getExamplesCoinsMedTypes((int) $this->_getParam('id'), 4); } else { throw new Pas_Exception_Param($this->_missingParameter); } }
/** View the individual person's account */ public function personAction() { if ($this->_getParam('as', 0)) { $id = $this->_getParam('as'); $users = new Users(); $this->view->accountdata = $users->getUserAccountData($id); $this->view->totals = $users->getCountFinds($this->getIdentityForForms()); $slides = new Slides(); $this->view->images = $slides->recentFinds($id); } else { throw new Pas_Exception_Param($this->_missingParameter); } }
public function actionIndex() { if (!empty($this->arrSystem)) { $this->pageTitle = "Trang chủ - " . $this->arrSystem->title; } // Hinh anh trinh dien $criteria = new CDBCriteria(); $criteria->addCondition("is_product = 3"); $arrImage = Slides::model()->findAll($criteria); // Linh vuc kinh doanh $criteria = new CDBCriteria(); $criteria->addCondition("category_news_id = 1"); $criteria->limit = 3; $arrNew = News::model()->findAll($criteria); // tin tuc noi bat $criteria = new CDBCriteria(); $criteria->addCondition("category_news_id != 1"); $criteria->order = 'id DESC'; $criteria->limit = 3; $arrNewSpecial = News::model()->findAll($criteria); // hinh anh noi bat $criteria = new CDBCriteria(); $criteria->addCondition("is_product = 1"); $criteria->order = 'id DESC'; $criteria->limit = 8; $arrImageSpecial = Slides::model()->findAll($criteria); $this->render("index", array('arrImage' => $arrImage, 'arrNew' => $arrNew, 'arrNewSpecial' => $arrNewSpecial, 'arrImageSpecial' => $arrImageSpecial)); }
static function show() { $slides = Slides::where('deleted', '=', 0)->where('pos', '=', 1)->where('active', '=', 1)->get(); foreach ($slides as $s) { echo ' <div class="front"><img src="' . asset('images/slides-top/' . $s->image) . '"/></div>'; } }
public function actionIndex($id = null) { if (!empty($this->arrSystem)) { $this->pageTitle = "Hình ảnh - " . $this->arrSystem->title; } $criteria = new CDBCriteria(); $title = ""; if ($id == null) { $criteria->addCondition("is_product = 1"); $title = "Hình ảnh hoạt động"; } else { if ($id == 2) { $criteria->addCondition("is_product = 2"); $title = "Sản phẩm mới"; } else { throw new CHttpException(404, 'Không tìm thấy trang!.'); } } $countItem = Slides::model()->count($criteria); $pages = new CPagination($countItem); $pages->setPageSize(12); $pages->applyLimit($criteria); $arrNew = Slides::model()->findAll($criteria); $arrImage = Slides::model()->findALl($criteria); $this->render("index", array('arrImage' => $arrImage, 'item_count' => $countItem, 'page_size' => 12, 'pages' => $pages, 'title' => $title)); }
public function loadModel($id) { $model = Slides::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function getIndex() { $title = 'Tecnographic Venezuela | diseño y desarrollo de paginas web,imagen corporativa y sistemas administrativos'; $meta = "Somos una empresa de diseño y desarrollo de paginas web en la ciudad de maracay"; $href = array('#home', '#about', '#project', '#news', '#contact'); $servicios = Servicios::get(); $slidesSup = Slides::where('tipo', '=', 1)->where('activo', '=', 1)->where('deleted', '=', 0)->get(); $slidesInf = Slides::where('tipo', '=', 2)->where('activo', '=', 1)->where('deleted', '=', 0)->get(); return View::make('home.index')->with('title', $title)->with('href', $href)->with('meta', $meta)->with('servicios', $servicios)->with('slidesSup', $slidesSup)->with('slidesInf', $slidesInf)->with('lang', Session::get('language')); }
/** Set up the individual emperor */ public function emperorAction() { if ($this->_getParam('id', false)) { $this->view->inlineScript()->appendFile('http://maps.google.com/maps?file=api&v=2.x&key=' . $this->_googleapikey, $type = 'text/javascript'); $id = (int) $this->_getParam('id'); $emps = new Emperors(); $this->view->emps = $emps->getEmperorDetails($id); $denoms = new Denominations(); $this->view->denoms = $denoms->getEmperorDenom($id); $mints = new Mints(); $this->view->mints = $mints->getMintEmperorList($id); $counts = new Finds(); $this->view->counts = $counts->getCountEmperor($this->_getParam('id')); $images = new Slides(); $this->view->images = $images->getExamplesCoinsEmperors($id, 4); } else { throw new Pas_Exception_Param($this->_missingParameter); } }
public function actionIndex() { $this->pageTitle = $this->dataSystem->title; // Dang ky Internet $criInternet = new CDBCriteria(); $criInternet->addCondition("category_news_id = 1"); $criInternet->order = "id DESC"; $criInternet->limit = 3; $arrInternet = News::model()->findAll($criInternet); //Dang ky cap quang $criOptical = new CDBCriteria(); $criOptical->addCondition("category_news_id = 2"); $criOptical->order = "id DESC"; $criOptical->limit = 3; $arrOptical = News::model()->findAll($criOptical); //Store $criStore = new CDBCriteria(); $criStore->addCondition("category_news_id = 6"); $criStore->order = "id DESC"; $criStore->limit = 3; $arrStore = News::model()->findAll($criStore); //CA $criCa = new CDBCriteria(); $criCa->addCondition("category_news_id = 3"); $criCa->order = "id DESC"; $criCa->limit = 3; $arrCa = News::model()->findAll($criCa); //Sim - Card $criSimCard = new CDBCriteria(); $criSimCard->addCondition("category_news_id = 4"); $criSimCard->order = "id DESC"; $criSimCard->limit = 3; $arrSimCard = News::model()->findAll($criSimCard); //TV $criTv = new CDBCriteria(); $criTv->addCondition("category_news_id = 7"); $criTv->order = "id DESC"; $criTv->limit = 3; $arrTv = News::model()->findAll($criTv); /*Pictures*/ $criPic = new CDbCriteria(); $criPic->addCondition("album_id = 2"); $criPic->order = "id DESC"; $criPic->limit = 10; $arrPic = Images::model()->findAll($criPic); /*Slider*/ $criBanner = new CDbCriteria(); $criBanner->order = "id DESC"; $criBanner->limit = 5; $arrBanner = Slides::model()->findAll($criBanner); /*Links web*/ $arrLink = Links::model()->find(); $this->render("index", array('arrBanner' => $arrBanner, 'arrInternet' => $arrInternet, 'arrOptical' => $arrOptical, 'arrStore' => $arrStore, 'arrCa' => $arrCa, 'arrSimCard' => $arrSimCard, 'arrTv' => $arrTv, 'arrLink' => $arrLink)); }
public function actionDelete($id) { $model = Slides::model()->findByPk($id); if ($model == null) { $this->redirect(PIUrl::createUrl('/admin/slides/index/')); } $name = $model->attributes['image']; $this->loadModel($id)->delete(); if (file_exists(Yii::app()->basePath . '/upload/images/' . $name) && $name->image != '') { unlink(Yii::app()->basePath . '/upload/images/' . $name); } Yii::app()->user->setFlash('success', translate('Xóa thành công.')); // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser $this->redirect(PIUrl::createUrl('/admin/slides')); }
public function actionIndex($alias) { /*Get news by alias*/ $category = CategoriesNews::model()->findByAttributes(array('alias' => $alias)); if ($category === null) { throw new CHttpException(404, 'Không tìm thấy trang'); } $this->pageTitle = $category->name . ($category->title ? ' - ' . $category->title : ''); $this->description = $category->description; $this->dataSystem->keyword = $category->keyword; $criteria = new CDbCriteria(); $criteria->addCondition("category_news_id = " . $category['id']); $criteria->order = "id DESC"; $count = News::model()->count($criteria); $pages = new CPagination($count); $pages->setPageSize($this->pageSize); $pages->applyLimit($criteria); /*Slider*/ $criBanner = new CDbCriteria(); $criBanner->order = "id DESC"; $criBanner->limit = 5; $arrBanner = Slides::model()->findAll($criBanner); $this->render('index', array('arrBanner' => $arrBanner, 'model' => News::model()->findAll($criteria), 'page_size' => $this->pageSize, 'count' => $count, 'pages' => $pages, 'category' => $category)); }
public function deletelatestreviewsAction() { global $mySession; $db = new Db(); $lId = $_REQUEST['Id']; $lppty_type = $this->getRequest()->getParam("lppty_type"); $myObj = new Slides(); $Result = $myObj->deleteLatestReview($lId, $lppty_type); if ($Result > 0) { $mySession->sucessMsg = "Latest Property Deleted successfully."; } else { $mySession->errorMsg = "An Error Occurred while trying to delete the data"; } exit; }
public function upload() { if ($this->_helper->Identity()) { //Check if images path directory is writable if (!is_writable(IMAGE_PATH)) { throw new Pas_Exception_NotAuthorised('The images directory is not writable', 500); } // Create the imagedir path $imagedir = IMAGE_PATH . '/' . $this->_helper->Identity()->username; //Check if a directory and if not make directory if (!is_dir($imagedir)) { mkdir($imagedir, 0775, true); } //Check if the personal image directory is writable if (!is_writable($imagedir)) { throw new Pas_Exception_NotAuthorised('The user image directory is not writable', 500); } // Get images and do the magic $adapter = new Zend_File_Transfer_Adapter_Http(); $adapter->setDestination($imagedir); $adapter->setOptions(array('useByteString' => false)); // Only allow good image files! $adapter->addValidator('Extension', false, 'jpg, tiff'); $adapter->addValidator('NotExists', false, array($imagedir)); $files = $adapter->getFileInfo(); // Create an array for the images $images = array(); // Loop through the submitted files foreach ($files as $file => $info) { // file uploaded & is valid // if (!$adapter->isUploaded($file)) continue; // if (!$adapter->isValid($file)) continue; // Clean up the image name for crappy characters $filename = pathinfo($adapter->getFileName($file)); // Instantiate the renamer $reNamer = new Pas_Image_Rename(); // Clean the filename $cleaned = $reNamer->strip($filename['filename'], $filename['extension']); // Rename the file $adapter->addFilter('rename', $cleaned); // receive the files into the user directory $adapter->receive($file); // this has to be on top if (!$adapter->hasErrors()) { // Create the object for reuse $image = new stdClass(); $image->cleaned = $cleaned; $image->basename = $filename['basename']; $image->extension = $filename['extension']; $image->thumbnailUrl = $this->createThumbnailUrl($adapter->getFileName($file, false)); $image->deleteUrl = $this->_createUrl($adapter->getFileName($file, false)); $image->path = $adapter->getFileName($file); $image->name = $adapter->getFileName($file, false); $image->size = $adapter->getFileSize($file); $image->mimetype = $adapter->getMimeType($file); // The secure ID stuff for linking images $image->secuid = $this->_helper->GenerateSecuID(); // Get the image dims $imagesize = getimagesize($adapter->getFileName($file)); $image->width = $imagesize[0]; $image->height = $imagesize[1]; $params = $this->getAllParams(); $image->findID = $params['findID']; // Create the raw image url $image->url = $this->_createUrl($adapter->getFileName($file, false)); $image->deleteType = 'DELETE'; $images[] = $image; $slides = new Slides(); $insert = $slides->addAndResize($images); $this->view->data = $images; $this->_helper->solrUpdater->update('images', (int) $insert); $this->_helper->solrUpdater->update('objects', $params['findID'], 'artefacts'); } else { $image = new stdClass(); $image->error = $adapter->getErrors(); $images[] = $image; $this->view->data = $images; } } } else { throw new Pas_Exception_NotAuthorised('Your account does not seem enabled to do this', 500); } }
/** Link an image * @access public * @return mixed * @throws Pas_Exception_Param */ public function linkimageAction() { if ($this->getParam('secuid', false)) { $this->_helper->layout->disableLayout(); $form = new ImageLinkForm(); $this->view->form = $form; $images = new Slides(); $this->view->images = $images->getImageForLinks($this->getParam('secuid')); } else { throw new Pas_Exception_Param($this->_missingParameter, 500); } }
/** Display individual record * @access public * @return void */ public function recordAction() { if ($this->getParam('id', false)) { $this->view->recordID = $this->getParam('id'); $id = $this->getParam('id'); $finds = $this->getFinds()->getAllData($id); $this->_helper->availableOrNot($finds); $this->view->finds = $finds; $coins = new Coins(); $this->view->coins = $coins->getCoinData($id); $coinRefs = new CoinClassifications(); $this->view->coinrefs = $coinRefs->getAllClasses($id); $thumbs = new Slides(); $this->view->thumbs = $thumbs->getThumbnails($id, 'artefacts'); $refs = new Publications(); $this->view->refs = $refs->getReferences($id); $this->view->comments = $this->getComments()->getFindComments($id); $models = new SketchFab(); $this->view->sketchfab = $models->getModels($id); } else { throw new Pas_Exception_Param($this->_missingParameter, 500); } }
public function home() { $slides = Slides::orderBy('slide_order', 'ASC')->get(); return View::make('home')->with('page_title', 'Home')->with('slides', $slides); }
/** Display individual record * @todo move comment functionality to a model */ public function recordAction() { if ($this->_getParam('id', false)) { $this->view->recordID = $this->_getParam('id'); $id = $this->_getParam('id'); $findsdata = $this->_finds->getIndividualFind($id, $this->getRole()); if ($findsdata) { $this->view->finds = $findsdata; } else { throw new Pas_Exception_NotAuthorised('You are not authorised to view this record'); } $contexts = array('xml', 'rss', 'json', 'atom', 'kml', 'georss', 'ics', 'rdf', 'xcs', 'vcf', 'csv', 'pdf'); if (!in_array($this->_cs->getCurrentContext(), $contexts)) { $this->view->findsdata = $this->_finds->getFindData($id); $this->view->findsmaterial = $this->_finds->getFindMaterials($id); $this->view->temporals = $this->_finds->getFindTemporalData($id); $this->view->nexts = $this->_finds->getNextObject($id); $this->view->recordsprior = $this->_finds->getPreviousObject($id); $this->view->peoples = $this->_finds->getPersonalData($id); $this->view->findotherrefs = $this->_finds->getFindOtherRefs($id); $findspotsdata = new Findspots(); $this->view->findspots = $findspotsdata->getFindSpotData($id); $rallyfind = new Rallies(); $this->view->rallyfind = $rallyfind->getFindToRallyNames($id); $coins = new Coins(); $this->view->coins = $coins->getCoinData($id); $coinrefs = new Coinclassifications(); $this->view->coinrefs = $coinrefs->getAllClasses($id); $thumbs = new Slides(); $this->view->thumbs = $thumbs->getThumbnails($id); $refs = new Publications(); $this->view->refs = $refs->getReferences($id); $comments = new Comments(); $this->view->comments = $comments->getFindComments($id); $response = $this->getResponse(); if (in_array($this->getRole(), $this->_higherLevel) && !in_array($this->_cs->getCurrentContext(), array('xml', 'json', 'qrcode'))) { $wform = new WorkflowStageForm(); $wform->id->setValue($id); $wform->submit->setLabel('Change workflow'); $this->view->wform = $wform; $response->insert('workflow', $this->view->render('structure/workflow.phtml')); } else { $findspotsdata = new Findspots(); $this->view->findspots = $findspotsdata->getFindSpotData($id); } $form = new CommentFindForm(); $form->submit->setLabel('Add a new comment'); $this->view->form = $form; if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) { if ($form->isValid($form->getValues())) { $data = $form->getValues(); if ($this->getHelper->getAkismet()->isSpam($data)) { $data['comment_approved'] = 'spam'; } else { $data['comment_approved'] = 'moderation'; } $comments = new Comments(); $insert = $comments->insert($data); $this->_flashMessenger->addMessage('Your comment has been entered and will appear shortly!'); $this->_redirect(self::REDIRECT . 'record/id/' . $this->_getParam('id')); $this->_request->setMethod('GET'); } else { $this->_flashMessenger->addMessage('There are problems with your comment submission'); $form->populate($formData); } } } else { $this->_helper->layout->disableLayout(); //disable layout $record = $this->_finds->getAllData($id); if ($this->_auth->hasIdentity()) { $user = $this->_auth->getIdentity(); if (in_array($user->role, $this->_restricted)) { $record['0']['gridref'] = NULL; $record['0']['easting'] = NULL; $record['0']['northing'] = NULL; $record['0']['lat'] = NULL; $record['0']['lon'] = NULL; $record['0']['finder'] = NULL; $record['0']['address'] = NULL; $record['0']['postcode'] = NULL; $record['0']['findspotdescription'] = NULL; } } else { $record['0']['gridref'] = NULL; $record['0']['easting'] = NULL; $record['0']['northing'] = NULL; $record['0']['lat'] = NULL; $record['0']['lon'] = NULL; $record['0']['finder'] = NULL; $record['0']['address'] = NULL; $record['0']['postcode'] = NULL; $record['0']['findspotdescription'] = NULL; if (!is_null($record['0']['knownas'])) { $record['0']['parish'] = NULL; $record['0']['fourFigure'] = NULL; } } $this->view->record = $record; } } else { throw new Pas_Exception_Param($this->_missingParameter); } }
/** Show images attached to record * @access public * @return void * @throws Pas_Exception_Param */ public function attachedAction() { if ($this->getParam('id', false)) { $help = new Help(); $this->view->contents = $help->fetchRow('id = 14')->toArray(); $images = new Slides(); $this->view->images = $images->getSlides($this->getParam('id')); } else { throw new Pas_Exception_Param($this->_missingParameter, 404); } }
/** Display a report in pdf format */ public function reportAction() { if ($this->_getParam('id', false)) { $this->view->recordID = $this->_getParam('id'); $id = $this->_getParam('id'); $finds = new Finds(); $findsdata = $finds->getIndividualFind($id, $this->getRole()); if (count($findsdata)) { $this->view->finds = $findsdata; } else { throw new Pas_Exception_NotAuthorised('You are not authorised to view this record'); } $findsdata = new Finds(); $this->view->findsdata = $findsdata->getFindData($id); $this->view->findsmaterial = $findsdata->getFindMaterials($id); $this->view->temporals = $findsdata->getFindTemporalData($id); $this->view->peoples = $findsdata->getPersonalData($id); $rallyfind = new Rallies(); $this->view->rallyfind = $rallyfind->getFindRallyNames($id); $coins = new Coins(); $this->view->coins = $coins->getCoinData($id); $thumbs = new Slides(); $this->view->thumbs = $thumbs->getThumbnails($id); $refs = new Publications(); $this->view->refs = $refs->getReferences($id); $findspotsdata = new Findspots(); $this->view->findspots = $findspotsdata->getFindSpotData($id); } else { throw new Pas_Exception_Param($this->_missingParameter, 500); } }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { $counties = new OsCounties(); $county_options = $counties->getCountyNames(); $periods = new Periods(); $period_options = $periods->getPeriodFrom(); $copyrights = new Copyrights(); $copy = $copyrights->getTypes(); $licenses = new LicenseTypes(); $license = $licenses->getList(); if (array_key_exists('id', $options)) { $slides = new Slides(); $images = $slides->getSlides($options['id']); } $auth = Zend_Auth::getInstance(); $this->_auth = $auth; if ($this->_auth->hasIdentity()) { $user = $this->_auth->getIdentity(); if (!is_null($user->copyright)) { $this->_copyright = $user->copyright; } elseif (!is_null($user->fullname)) { $this->_copyright = $user->first_name . ' ' . $user->last_name; } else { $this->_copyright = $user->fullname; } if (!is_null($user->fullname)) { $copy[] = $user->first_name . ' ' . $user->last_name; } else { $copy[] = $user->fullname; } } $copyList = array_filter(array_merge(array($this->_copyright => $this->_copyright), $copy)); parent::__construct($options); $this->setName('imagetofind'); $period = new Zend_Form_Element_Select('period'); $period->setLabel('Period: ')->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow required')->addErrorMessage('You must enter a period for the image')->addMultiOptions(array(null => 'Select a period', 'Valid periods' => $period_options))->addValidator('inArray', false, array(array_keys($period_options))); $country = new Zend_Form_Element_Select('country'); $country->setLabel('Country: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow required')->setRequired(true)->addErrorMessage('You must enter a country of origin')->addMultiOptions(array(null => 'Select a country of origin', 'Valid countries' => array('England' => 'England', 'Wales' => 'Wales')))->addValidator('inArray', false, array(array_keys($county_options))); $county = new Zend_Form_Element_Select('county'); $county->setLabel('County: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow required')->setRequired(true)->addErrorMessage('You must enter a county of origin')->addMultiOptions(array(null => 'Select a county of origin', 'Valid counties' => $county_options))->addValidator('inArray', false, array(array_keys($county_options))); $copyright = new Zend_Form_Element_Select('imagerights'); $copyright->setLabel('Image copyright: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->addErrorMessage('You must enter a licence holder')->addMultiOptions(array(null => 'Select a licence holder', 'Valid copyrights' => $copyList))->setDescription('You can set the copyright of your image here to your institution. If you are a public recorder, it should default to your full name. For institutions that do not appear contact head office to suggest its addition')->setValue($this->_copyright); $licenseField = new Zend_Form_Element_Select('ccLicense'); $licenseField->setDescription('Our philosophy is to make our content available openly, by default we set the license as use by attribution to gain the best public benefit. You can choose a different license if you wish.'); $licenseField->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setLabel('Creative Commons license:')->addMultiOptions(array(null => 'Select a license', 'Available licenses' => $license))->setValue(4)->addValidator('Int'); $type = new Zend_Form_Element_Select('type'); $type->setLabel('Image type: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->addMultiOptions(array(null => 'Select the type of image', 'Image types' => array('digital' => 'Digital image', 'illustration' => 'Scanned illustration')))->setValue('digital'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Add metadata for images'); $this->addElements(array($country, $county, $period, $copyright, $type, $licenseField, $submit)); $this->setMethod('post'); $this->addDisplayGroup(array('country', 'filename', 'county', 'period', 'imagerights', 'ccLicense', 'type'), 'details'); foreach ($images as $image) { $label = 'label' . $image['imageID']; $group = 'metadata' . $image['imageID']; echo '<img src="http://finds.org.uk/images/thumbnails/' . $image['imageID'] . '.jpg"/>'; $image['imageID'] = new Zend_Form_Element_Text($label); $image['imageID']->setLabel('Image label: ')->setRequired(true)->setAttribs(array('size' => 60, 'class' => 'span6 required'))->addErrorMessage('You must enter a label')->setDescription('This must be descriptive text about the image - NOT THE FILE or FIND NUMBER/NAME - and follow the conventions outlined below this form')->addFilters(array('StripTags', 'StringTrim')); $this->addElements(array($image['imageID'])); $this->addDisplayGroup(array($label), $group); } $this->addDisplayGroup(array('submit'), 'buttons')->removeDecorator('HtmlTag'); $this->details->setLegend('Attach an image'); parent::init(); }
<?php if (!_acl::isAllow('slides')) { die("Access denied"); } $Slides = new Slides(); unset($parsed_res); $tpl->Assign('h1', 'Слайды'); $ii = count($GLOBALS['IERA_LINKS']); $GLOBALS['IERA_LINKS'][$ii]['title'] = "Слайды"; if (isset($_GET['upload'])) { $upload_handler = new UploadHandler(array('download_via_php' => true, 'upload_dir' => $_SERVER['DOCUMENT_ROOT'] . '/images/slides/', 'upload_url' => $_SERVER['DOCUMENT_ROOT'] . '/images/slides/', 'user_dirs' => false, 'param_name' => 'img', 'accept_file_types' => '/\\.(gif|jpe?g|jpg|png)$/i')); exit(0); } $Slides->SlidesList(1); $tpl->Assign('list', $Slides->list); $parsed_res = array('issuccess' => true, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'cp_slides.tpl')); if (true == $parsed_res['issuccess']) { $tpl_center .= $parsed_res['html']; }
public function post_upload() { $input = Input::all(); $rules = array('file' => 'image|max:3000'); $messages = array('image' => 'Todos los archivos deben ser imagenes', 'max' => 'Las imagenes deben ser de menos de 3Mb'); $validation = Validator::make($input, $rules, $messages); if ($validation->fails()) { return Response::make($validation)->withErrors($validation); } $images = new Slides(); $file = Input::file('file'); $tipo = Input::get('tipo'); if (file_exists('images/slides-top/' . $file->getClientOriginalName())) { //guardamos la imagen en public/imgs con el nombre original $i = 0; //indice para el while //separamos el nombre de la img y la extensión $info = explode(".", $file->getClientOriginalName()); //asignamos de nuevo el nombre de la imagen completo $miImg = $file->getClientOriginalName(); //mientras el archivo exista iteramos y aumentamos i while (file_exists('images/slides-top/' . $miImg)) { $i++; $miImg = $info[0] . "(" . $i . ")" . "." . $info[1]; } //guardamos la imagen con otro nombre ej foto(1).jpg || foto(2).jpg etc $file->move("images/slides-top/", $miImg); if ($miImg != $file->getClientOriginalName()) { $images->image = $miImg; } } else { $file->move("images/slides-top/", $file->getClientOriginalName()); $images->image = $file->getClientOriginalName(); } $images->tipo = $tipo; $images->save(); return Response::json(array('image' => $images->id)); }
public function linkimageAction() { if ($this->_getParam('secuid', false)) { $this->_helper->layout->disableLayout(); $form = new ImageLinkForm(); $this->view->form = $form; $images = new Slides(); $this->view->images = $images->getImageForLinks($this->_getParam('secuid')); } else { throw new Exception('No image id has been specified on the url string'); } }
public function postUpdateOrder() { $id = Input::get("data-id"); $order = Input::get("data-order"); // --- Create a new object --- // $record = Slides::find($id); $record->update(array('slide_order' => $order)); $record->save(); // --- Return object ID response JSON --- // if ($record != null) { return Response::json(array('success' => true)); } return Response::json(array('success' => false, 'id' => 'Something went wrong')); }
public function postElimSlides() { if (Request::ajax()) { $id = Input::get('id'); $slides = Slides::find($id); File::delete('images/slides-top/' . $slides->image); $slides->deleted = 1; if ($slides->save()) { return Response::json(array('type' => 'success', 'msg' => 'Slide eliminado satisfactoriamente')); } else { return Response::json(array('type' => 'danger', 'msg' => 'Error al eliminar el slide')); } } }
/** Unlink an image from a record */ public function unlinkAction() { if ($this->_getParam('returnID', false)) { $this->view->findID = $this->_getParam('secuid'); $this->view->returnID = $this->_getParam('returnID'); if ($this->_request->isPost()) { $id = (int) $this->_request->getPost('id'); $del = $this->_request->getPost('del'); if ($del == 'Yes' && $id > 0) { $imageID = $this->_request->getPost('imageID'); $findID = $this->_request->getPost('findID'); $slides = new Slides(); $imagedata = $slides->fetchRow('imageID = ' . $id); $imageID = $imagedata['secuid']; $linked = new FindsImages(); $where = array(); $where[] = $linked->getAdapter()->quoteInto('image_id = ?', $imageID); $where[] = $linked->getAdapter()->quoteInto('find_id = ?', $findID); $linked->delete($where); $this->_flashMessenger->addMessage('Image and links deleted!'); $this->_redirect('/database/artefacts/record/id/' . $this->_getParam('returnID')); $this->_helper->cache->remove('findtoimage' . $returnID); } } else { $id = (int) $this->_request->getParam('id'); if ((int) $id > 0) { $this->view->slide = $this->_images->fetchRow($slides->select()->where('imageID = ?', $id)); $this->view->params = $this->_getAllParams(); } } } else { throw new Pas_Exception_Param($this->_missingParameter); } }
public function getFront() { $title = "Portada"; $slides = Slides::where('deleted', '=', 0)->where('pos', '=', 2)->get(); return View::make('indexs.portada')->with('title', $title)->with('slides', $slides); }
<?if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'){ $Slides = new Slides(); if(isset($_POST['action'])) switch($_POST['action']){ case "sort": if($Slides->SortSlides($_POST['data'])){ return true; }else{ return false; } break; case "add": $id = $Slides->AddSlide($_POST); echo $id; break; case "delete": if($id = $Slides->DeleteSlide($_POST['id'])){ return true; }else{ return false; } break; case "update": if($Slides->UpdateSlide($_POST)){ echo 'good'; }else{ return false; } break; default: break;