Member
Member
Jaanus   2010-06-20, 11:34
#1

Hi all,
could you think about improvement of the search engine so that we could search by date using calendar popup? And if possible search the pictures taken between two dates?

Another little idea - is there some particular cause why we can not give to archive a calendar view? That means the visitor could choose if he/she want to see picture arhive as it is displayed today (list of years, months) or as a calendar view? Also, not most important but still very nice would be an iCal feed for those people who may want to show (links to) pictures in their calendar (Google etc).

Administrator
Administrator
acrylian   2010-06-20, 12:39
#2

Ideas are always welcome, but we probably won't do any of these. Some can be done via theming or plugins. Might require some work though.

So you are invited to provide third party solutions for what you need and provide it for others.
http://www.zenphoto.org/get-involved/

Member
Member
sbillard   2010-06-20, 17:41
#3

The search engine is quite capable of searching by date. You will just have to provide the user interface to do so. Archive pages are, of course, theme dependent. I am sure that the Zenphoto structure would support doing what you wish.

Member
Member
Jaanus   2010-06-20, 21:30
#4

Thank you for replies. Sorry I have not enough programming skills. I just hope that someone who have skills read this and "take the fire".

But can you tell me how to make with today's search form query par exemple "between 2009-07-12 and 2010-01-01" to see pictures taken during this periode?

Member
Member
sbillard   2010-06-21, 02:33
#5

You can look at the archive page of one of the standard themes to see how it does searches on dates. Beyond that you will have to look at the class-search script to see what facilities it provides.

Member
Member
spmeckar   2010-07-19, 13:25
#6

Hi everyone!
I have started a calendar plugin for the archive page.

But I have a problem. I have done the SQL request so that I have one picture per day but then I do not have informations about the picture: album that it belongs to, paht of the picture to display it, ... and I would like that when I click on the picture, I use the "search" page to display the pictures from the selected day.

Could you please explain me, how to create the plugin properly so that I use the Image class and use the search engine.

Thanks.

PS: I hope you understood everything :-)

Administrator
Administrator
acrylian   2010-07-19, 13:51
#7

You should look at the object model tutorial.

Member
Member
spmeckar   2010-07-19, 14:14
#8

I went trough this tutorial but it didn't help. It doesn't explain where the SQL request must be given, and what are the information needed to create an object.

For example, to create an album object, I need to have a gallery object and the folder name, and to create an image object, I need an album object and the file name of the picture. But I do not have the information at the beginning. I have only the SQL request.

--- Edit
Where can I have an gallery object? Isn't it created automatically?

For example, I have two albums in September 2009. Those two albums are on the 4 and 12. So my SQL request fetches the first picture of both dates. As result, I have an array of two picture with al the information about the picture and the album it belongs too.
How can I now use this information, and properly-coded, to show this to pictures and linked to the search page with the right search.

I'm really sorry for my questions and my ignorance.

Administrator
Administrator
acrylian   2010-07-19, 14:44
#9

The gallery object is normally automatically stored in the global $_zp_gallery on themes.

If you don't know the album name and/or image name before hand you have to get them. There are methods like getAlbums for example.

If you know the names of the albums, create an object of theme and then use getImages() on them. That is an array of the images in that album ordered how you set it in the options. From that you can now create your image objects.

Since you want a calendar it would be better to get images by date or mtime for each date first via SQL and then create an object from that for each. Each image has a albumid so that you then can get its album via SQL as well.

Member
Member
spmeckar   2010-07-19, 15:35
#10

Thank you for the answer!

I managed to create my objects and display the thumbnails. Youhouuu!!! :-).

Now the second part, is to link those thumbnails with the search page and the right date. So that the search page, displays all the pictures of the selected date.

I will take example from the original archive page.

When I'm finished with the calendar, I will post the code, so that it can be improved, before publishing it as a plugin.

Member
Member
spmeckar   2010-07-20, 15:26
#11

Hi everyone!
I managed the calendar plug-in. I must admit that I'm proud of it but I also know that it can be improved.
Please let me know any suggestion. I will give a link on my web page in some days, so you have an example of the plug-in.

So here is the code.

`
/**

  • Calendar
  • It display a calendar per month or per year, with a picture in each where needed
  • @author the Whole Life To Learn
  • @package plugins
    */

$plugin_description = gettext("Prints a calendar with a picture in each day where pictures belong to.");
$plugin_author = "the Whole Life To Learn";
$plugin_version = '1.0.0';
$option_interface = new Calendar();

class Calendar {

private $month;
private $year;
private $minDate;
private $maxDate;
private $strToTime;

/**
 * class constructor
 *
 */
public function __construct() {
    $this->getDates();
    $this->variablesInit();
}

/**
 * Reports the supported options
 *
 * @return array
 */
function getOptionsSupported() {
    $tmp = array(
        gettext('Monthy/Yearly') => array(
            'key' => 'calendar_month_year',
            'type' => OPTION_TYPE_RADIO,
            'buttons' => array(
                gettext('Monthly') => 'OPT_MONTH',
                gettext('Yearly') => 'OPT_YEAR'
            ),
            'desc' => gettext('Choose if you wish to display a monthly calendar (1 month per page or a yearly calendar (12 month per page)')
        )
    );

    return $tmp;
}

/**
 * get the dates that will be used
 *
 * @return admin_login
 */
private function getDates() {
    if( !( isset($_GET['month']) AND is_numeric($_GET['month']) AND $_GET['month'] >= 1 AND $_GET['month'] month = date('m');
        //$this->month = '09';
    } else {
        $this->month = $_GET['month'];
    }

    if( !( isset($_GET['year']) AND is_numeric($_GET['year']) AND $_GET['year'] year = date('Y');
        //$this->year = '2009';
    } else {
        $this->year = $_GET['year'];
    }
}

public function setDates($month, $year) {
    $this->month = $month;
    $this->year = $year;
    $this->variablesInit();
}

/**
 * Initializes the variables needed for the process
 *
 */
private function variablesInit() {
    $this->minDate = $this->year . '-' . $this->month . '-01';
    $this->maxDate = $this->year . '-' . $this->month . '-' .  date('t', strtotime($minDate)); // Last day of the month
    $this->strToTime = strtotime( $this->minDate );
    setOptionDefault('calendar_month_year', 'OPT_MONTH');
}

/**
 * Fetches in the database the picture that should be displayed
 *
 * @return array
 */
protected function getMonth() {
    $allDates = array();
    $allFiles = array();
    $sql = "SELECT DATE_FORMAT(". prefix('images') . ".date, '%Y-%m-%d') as day, ". prefix('albums') . ".title, filename, folder FROM ". prefix('images') . ", ". prefix('albums') . " WHERE ". prefix('images') . ".albumid = ". prefix('albums') . ".id AND ". prefix('images') . ".date >= '$this->minDate' AND ". prefix('images') . ".date 
Administrator
Administrator
acrylian   2010-07-22, 10:12
#12

I took just a quick look and will wait for any download to test. Why don't you use a global variable for the calendar object instead of having each function create it's own object?

Although it probably works the class object you create with $option_interface = new Calendar(); is actually only meant for the plugin option setup for the backend.

Member
Member
theWholeLifeToLearn   2010-07-22, 11:58
#13

Hi!
I was using my brothers account and I created now my own.

I have created a post for this plug-in few seconds ago at this page:
http://www.zenphoto.org/support/topic.php?id=7782&replies=1#post-45970

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.