/** * Called when the page is set before rendering. * * This calendar caches the pictures and journals for the new page. * * @access private */ protected function _page_changed() { $first_day = new DATE_TIME(mktime(0, 0, 0, $this->_curr_month, 1, $this->_curr_year)); $last_day = new DATE_TIME(mktime(23, 59, 59, $this->_curr_month, $first_day->last_legal_day(), $this->_curr_year)); $journal_query = $this->album->entry_query(); $journal_query->set_type('journal'); $journal_query->set_days($first_day->as_iso(), $last_day->as_iso()); $this->_journals = $journal_query->objects(); $picture_query = $this->album->entry_query(); $picture_query->set_type('picture'); $picture_query->set_days($first_day->as_iso(), $last_day->as_iso()); $this->_pictures = $picture_query->objects(); }
/** * Add buttons that create items in the folder. * @param ALBUM $folder * @access private */ protected function _add_creators($folder) { $cmd = $this->make_command(); $cmd->id = 'new_picture'; $cmd->caption = 'New picture'; if ($folder->is_organizational()) { $cmd->link = "select_folder.php?page_name=create_picture.php"; } else { $cmd->link = "create_picture.php?id={$folder->id}"; } $cmd->icon = '{app_icons}buttons/new_picture'; $cmd->executable = $folder->app->login->is_allowed(Privilege_set_entry, Privilege_create, $folder); $cmd->importance = Command_importance_high + Command_importance_increment; $this->append($cmd); $cmd = $this->make_command(); $cmd->id = 'new_journal'; $cmd->caption = 'New journal'; if ($folder->is_organizational()) { $cmd->link = "select_folder.php?page_name=create_journal.php"; } else { $cmd->link = "create_journal.php?id={$folder->id}"; } $cmd->link = "create_journal.php?id={$folder->id}"; $cmd->icon = '{app_icons}buttons/new_journal'; $cmd->executable = $folder->app->login->is_allowed(Privilege_set_entry, Privilege_create, $folder); $cmd->importance = Command_importance_high - Command_importance_increment; $this->append($cmd); $cmd = $this->make_command(); $cmd->id = 'upload_pictures'; $cmd->caption = 'Upload pictures'; if ($folder->is_organizational()) { $cmd->link = "select_folder.php?page_name=upload_pictures.php"; } else { $cmd->link = "upload_pictures.php?id={$folder->id}"; } $cmd->icon = '{icons}buttons/upload'; $cmd->executable = $folder->app->login->is_allowed(Privilege_set_entry, Privilege_create, $folder) && $folder->app->login->is_allowed(Privilege_set_entry, Privilege_upload, $folder) && $folder->uploads_allowed(); $cmd->importance = Command_importance_high + Command_importance_increment; $this->append($cmd); }
/** * Outputs the object as plain text. * @param ALBUM $obj * @access private */ protected function _display_as_plain_text($obj) { if (!$obj->is_organizational()) { $f = $obj->first_day->formatter(); $f->clear_flags(); echo $this->line($obj->format_date($obj->first_day, $f) . ' - ' . $obj->format_date($obj->last_day, $f)); } parent::_display_as_plain_text($obj); }
/** * Store the form's values to this album. * @param ALBUM $obj * @access private */ protected function _store_to_object($obj) { $obj->url_root = $this->value_as_text('url_root'); $obj->location = $this->value_as_text('location'); /** @var DATE_TIME $first_day_value */ $first_day_value = $this->value_for('first_day'); /** @var DATE_TIME $last_day_value */ $last_day_value = $this->value_for('last_day'); $obj->show_times = $this->value_for('show_times'); $obj->show_celsius = $this->value_for('show_celsius'); $obj->set_date_style($this->value_for('date_style'), $first_day_value, $last_day_value); $obj->main_picture_id = $this->value_for('main_picture_id'); if ($this->value_for('constrain_picture_size')) { $obj->max_picture_width = $this->value_for('max_picture_width'); $obj->max_picture_height = $this->value_for('max_picture_height'); } else { $obj->max_picture_width = 0; $obj->max_picture_height = 0; } parent::_store_to_object($obj); }
/** * @param ALBUM $obj * @access private */ protected function _draw_box($obj) { $main_pic = $obj->main_picture(); if ($main_pic) { $f = $main_pic->date->formatter(); $f->show_CSS = false; $pic_title = $main_pic->title_as_plain_text() . " (" . $obj->format_date($main_pic->date, $f) . ")"; ?> <h3> <?php echo $obj->title_as_html(); ?> </h3> <?php $this->_display_start_overlay_commands($obj); ?> <div> <a href="view_folder.php?<?php echo "id={$obj->id}"; ?> "><img src="<?php echo $main_pic->full_thumbnail_name(); ?> " title="<?php echo $pic_title; ?> " alt="<?php echo $pic_title; ?> "></a> </div> <?php $this->_display_finish_overlay_commands(); } else { $this->_display_start_minimal_commands_block($obj); ?> <h3> <?php echo $obj->title_as_html(); ?> </h3> <p> <a href="view_folder.php?<?php echo "id={$obj->id}"; ?> "><?php echo $obj->title; ?> </a> </p> <?php $this->_display_finish_minimal_commands_block(); } ?> <p class="detail"> <?php if ($obj->is_multi_day()) { echo $obj->format_date($obj->first_day) . ' - ' . $obj->format_date($obj->last_day); } else { echo $obj->format_date($obj->first_day); } ?> </p> <div class="text-flow multi-column-grid-description"> <?php echo $obj->summary_as_html(); ?> </div> <?php }