本文整理汇总了PHP中Gallery类的典型用法代码示例。如果您正苦于以下问题:PHP Gallery类的具体用法?PHP Gallery怎么用?PHP Gallery使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Gallery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
/**
* Load your component.
*
* @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page
*/
public function load(\Cx\Core\ContentManager\Model\Entity\Page $page)
{
global $_CORELANG, $subMenuTitle, $objTemplate;
switch ($this->cx->getMode()) {
case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
$objGallery = new Gallery(\Env::get('cx')->getPage()->getContent());
\Env::get('cx')->getPage()->setContent($objGallery->getPage());
$topGalleryName = $objGallery->getTopGalleryName();
if ($topGalleryName) {
\Env::get('cx')->getPage()->setTitle($topGalleryName);
\Env::get('cx')->getPage()->setContentTitle($topGalleryName);
\Env::get('cx')->getPage()->setMetaTitle($topGalleryName);
}
break;
case \Cx\Core\Core\Controller\Cx::MODE_BACKEND:
$this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html');
$objTemplate = $this->cx->getTemplate();
\Permission::checkAccess(12, 'static');
$subMenuTitle = $_CORELANG['TXT_GALLERY_TITLE'];
$objGalleryManager = new GalleryManager();
$objGalleryManager->getPage();
break;
default:
break;
}
}
示例2: index
/**
* The gallery index handler.
*
* @access public
* @return string The HTML code.
*/
public function index()
{
$Gallery = new Gallery();
$params = array();
$params[] = 'Type = ' . Gallery::GALLERY;
$this->getView()->set('Galleries', $Gallery->findList($params, 'Position asc'));
return $this->getView()->render();
}
示例3: forceAlbum
function forceAlbum($success)
{
// we presume that the site only serves the one album.
$gallery = new Gallery();
$albums = $gallery->getAlbums();
$_GET['album'] = array_shift($albums);
return $success;
}
示例4: index
/**
* The development index handler.
*
* @access public
* @return string The HTML code.
*/
public function index()
{
$Gallery = new Gallery();
$Award = new Award();
$this->getView()->set('Gallery', $Gallery->findItem(array('Type = ' . Gallery::DEVELOPMENT)));
$this->getView()->set('Patents', $Award->findList(array('Type = ' . Award::PATENT), 'Position asc'));
return $this->getView()->render();
}
示例5: _initFormForGallery
function _initFormForGallery(&$form, $gallery_id)
{
require_once 'Modules/Gallery/Gallery.php';
$dbcon =& AMP_Registry::getDbcon();
$publish_item = new Gallery($dbcon, $gallery_id);
$title = 'Photo Gallery: ' . $publish_item->getName();
return $this->_initFormPublishItem($form, $publish_item, AMP_CONTENT_CLASS_DEFAULT, $title);
}
示例6: delete
function delete($cat_id, $id = FALSE)
{
if ($id) {
$gallery = new Gallery($id);
$gallery->delete_file($gallery->id, 'uploads/galleries/', 'image');
$gallery->delete();
set_notify('success', lang('delete_data_complete'));
}
redirect('galleries/admin/galleries/index/' . $cat_id);
}
示例7: lamtech_preprocess_node
function lamtech_preprocess_node(&$vars)
{
// kpr($vars);
if (isset($vars['content']['field_category']) && count($vars['content']['field_category'])) {
$vars['category'] = $vars['content']['field_category'][0];
unset($vars['content']['field_category']);
}
$helper = NULL;
switch ($vars['type']) {
case 'cta':
require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/cta/CTA.php';
$helper = new CTA();
$helper->preprocess($vars);
break;
case 'features_intro':
require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/fi/FeaturesIntro.php';
$helper = new FeaturesIntro();
$helper->preprocess($vars);
break;
case 'gallery':
require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/gallery/Gallery.php';
$helper = new Gallery();
$helper->preprocess($vars);
break;
case 'testimonials':
require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/testimonials/Testimonials.php';
$helper = new Testimonials();
$helper->preprocess($vars);
break;
case 'hero':
require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/hero/Hero.php';
$helper = new Hero();
$helper->preprocess($vars);
break;
case 'team':
require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/team/Team.php';
$helper = new Team();
$helper->preprocess($vars);
break;
case 'statistic':
require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/statistic/Statistic.php';
$helper = new Statistic();
$helper->preprocess($vars);
break;
case 'contact_info':
require_once DRUPAL_ROOT . '/' . drupal_get_path('theme', 'lamtech') . '/tpl/anb/contact-info/ContactInfo.php';
$helper = new ContactInfo();
$helper->preprocess($vars);
break;
case 'advanced_page':
unset($vars['content']['field_hide_title']);
break;
}
// kpr($vars);
}
示例8: createAndUploadPhoto
public function createAndUploadPhoto(Gallery $gallery, array $values, \Nette\Web\HttpUploadedFile $file)
{
if (!$file->isImage()) {
throw new ValidationException("Soubor není obrázek.");
}
$photo = $this->createBlank();
$this->update($photo, $values);
$gallery->addPhoto($photo);
@mkdir(pathinfo($photo->getFilePath(), PATHINFO_DIRNAME), 0777, true);
$file->toImage()->resize($this->maxWidth, $this->maxHeight)->save($photo->getFilePath());
$this->save($gallery);
}
示例9: mod_gallery
/**
* Функция вывода галереи
*
* @param string $gallery_id идентификатор галереи
* и опционально количество изображений на странице
*/
function mod_gallery($gallery_id)
{
global $AVE_Template;
require_once BASE_DIR . '/modules/gallery/class.gallery.php';
$gallery = new Gallery();
$own_lim = @explode('-', stripslashes($gallery_id));
$lim = empty($own_lim[1]) ? '' : $own_lim[1];
$gallery_id = $own_lim[0];
$tpl_dir = BASE_DIR . '/modules/gallery/templates/';
$lang_file = BASE_DIR . '/modules/gallery/lang/' . $_SESSION['user_language'] . '.txt';
$AVE_Template->config_load($lang_file);
$gallery->galleryShow($tpl_dir, $gallery_id, $lim);
}
示例10: getList
function getList($params = NULL, $proyection = '*', $order = '1', $limit = '')
{
if ($this->db != NULL) {
$this->db->read($this->table, $proyection, $params);
$r = array();
while ($param = $this->db->getRow()) {
$gallery = new Gallery();
$gallery->set($param);
$r[] = $gallery;
}
return $r;
}
return NULL;
}
示例11: synchronize
/**
* {@inheritdoc}
*/
public function synchronize()
{
$this->pictures = array();
$config = GalleryConfig::load();
$Gallery = new Gallery();
$result = PersistenceContext::get_querier()->select("SELECT g.id, g.name, g.path, g.width, g.height, g.idcat, gc.auth\n\t\tFROM " . GallerySetup::$gallery_table . " g\n\t\tLEFT JOIN " . GallerySetup::$gallery_cats_table . " gc on gc.id = g.idcat\n\t\tWHERE g.aprob = 1\n\t\tORDER BY RAND()\n\t\tLIMIT 30");
while ($row = $result->fetch()) {
$row['auth'] = $row['idcat'] == 0 ? $config->get_authorizations() : unserialize(stripslashes($row['auth']));
//Calcul des dimensions avec respect des proportions.
list($row['width'], $row['height']) = $Gallery->get_resize_properties($row['width'], $row['height']);
$this->pictures[$row['id']] = $row;
}
$result->dispose();
}
示例12: email_new_user_save
function email_new_user_save($savemsg, $userobj, $what)
{
global $_zp_authority;
if ($what == 'new' && ($mail = $userobj->getEmail())) {
$gallery = new Gallery();
$ref = $_zp_authority->getResetTicket($adm = $userobj->getUser(), $userobj->getPass());
$msg = "\n" . sprintf(gettext('You are receiving this e-mail because a user code (%1$s) has been created for you on the Zenphoto gallery %2$s.'), $adm, $gallery->getTitle()) . "\n" . sprintf(gettext('To set your Zenphoto User password visit: %s'), FULLWEBPATH . "/" . ZENFOLDER . "/admin-users.php?ticket={$ref}&user={$adm}") . "\n" . gettext("This ticket will automatically expire in 3 days.");
$err_msg = zp_mail(gettext("The Zenphoto user created"), $msg, array($mail));
if (!empty($err_msg)) {
$savemsg .= $err_msg;
}
}
return $savemsg;
}
示例13: uploadPhoto
public function uploadPhoto(Gallery $gallery, array $values, \Nette\Web\HttpUploadedFile $file)
{
if (!$file->isImage()) {
throw new \Neuron\Model\ValidationException("File is not image.");
}
// save image
$image = $file->toImage()->resize($this->maxWidth, $this->maxHeight);
$values['hash'] = $this->repository->save((string) $image);
// save entity
$em = $this->getEntityManager();
$photo = new Photo($values);
$em->persist($photo);
$gallery->addPhoto($photo);
$em->flush();
}
示例14: actionShow
public function actionShow($id)
{
$model = Gallery::model()->findByPk((int) $id);
if (is_null($model)) {
throw new CHttpException(404, Yii::t('gallery', 'Страница не найдена!'));
}
$image = new Image();
if (Yii::app()->request->isPostRequest && isset($_POST['Image'])) {
$transaction = Yii::app()->db->beginTransaction();
try {
$image = $image->create($_POST['Image']);
if (!$image->hasErrors()) {
if ($model->addImage($image)) {
Yii::app()->user->setFlash(YFlashMessages::NOTICE_MESSAGE, Yii::t('gallery', 'Фотография добавлена!'));
}
$transaction->commit();
$this->redirect(array('/gallery/gallery/show/', 'id' => $model->id));
}
throw new CDbException(Yii::t('gallery', 'При добавлении изображения произошла ошибка!'));
} catch (Exception $e) {
$transaction->rollback();
Yii::app()->user->setFlash(YFlashMessages::ERROR_MESSAGE, Yii::t('gallery', $e->getMessage()));
}
}
$dataProvider = new CActiveDataProvider('ImageToGallery', array('criteria' => array('condition' => 'galleryId = :galleryId', 'params' => array(':galleryId' => $model->id), 'limit' => self::GALLERY_PER_PAGE, 'order' => 't.creation_date DESC', 'with' => 'image'), 'pagination' => array('pageSize' => self::GALLERY_PER_PAGE)));
$this->render('show', array('image' => $image, 'model' => $model, 'dataProvider' => $dataProvider));
}
示例15: generate_data_for_day
private static function generate_data_for_day(SS_Datetime $date)
{
$data = array('timestamp' => time(), 'searchDate' => $date->Format("Y-m-d"), 'collections' => array('events' => array(), 'galleries' => array(), 'locations' => array()));
$galleryIDs = array();
$locationIDs = array();
// Get events
$where = sprintf("DATE(`StartDate`) = '%s'", $date->Format('Y-m-d'));
$events = Event::get()->where($where)->exclude(array("GalleryID" => 0, "Gallery.LocationID" => 0));
foreach ($events as $event) {
$galleryIDs[] = $event->GalleryID;
$data['collections']['events'][] = $event->forAPI();
}
// Get galleries
$galleries = Gallery::get()->byIDs(array_unique($galleryIDs));
foreach ($galleries as $gallery) {
$locationIDs[] = $gallery->LocationID;
$data['collections']['galleries'][] = $gallery->forAPI();
}
// Get locations
$locations = Location::get()->byIDs(array_unique($locationIDs));
foreach ($locations as $location) {
$data['collections']['locations'][] = $location->forAPI();
}
return $data;
}