function ZooomrPhotosetsRuleSetViews($a_parameter_hash)
 {
     include 'Zooomr.Constants.php';
     $required_params = array('match_test', 'views');
     ZooomrPhotosetsRuleSet::params_are_valid($required_params, null, $a_parameter_hash);
     if ($a_parameter_hash['match_test'] != $VIEWS_EQUALTO and $a_parameter_hash['match_test'] != $VIEWS_NOTEQUALTO and $a_parameter_hash['match_test'] != $VIEWS_GREATERTHAN and $a_parameter_hash['match_test'] != $VIEWS_LESSTHAN) {
         throw new Exception("ZooomrPhotosetsRuleSetView: a_match constant not a recognised value");
     }
     $this->match_test = $a_parameter_hash['match_test'];
     $this->match_type = $PHOTOSETMATCH_VIEWS;
     $this->match_args = $a_parameter_hash['views'];
 }
 function ZooomrPhotosetsRuleSetDateUploaded($a_parameter_hash)
 {
     include 'Zooomr.Constants.php';
     $required_params = array('min_date');
     ZooomrPhotosetsRuleSet::params_are_valid($required_params, null, $a_parameter_hash);
     if (!is_a($a_parameter_hash['min_date'], 'DateTime')) {
         throw new Exception("zooomr.photos.recentlyUpdated requires a DateTime object for min_date");
     }
     // nt mktime ([ int $hour [, int $minute [, int $second [, int $month [, int $day [, int $year [, int $is_dst ]]]]]]] )
     $unixtime = date_format($a_parameter_hash['min_date'], "U");
     $this->match_test = "0";
     # no match test for Date Uploaded
     $this->match_type = $PHOTOSETMATCH_DATEUPLOADED;
     $this->match_args = $unixtime;
 }
 function ZooomrPhotosetsRuleSetLabels($a_parameter_hash)
 {
     include 'Zooomr.Constants.php';
     $required_params = array('match_test', 'labels');
     ZooomrPhotosetsRuleSet::params_are_valid($required_params, null, $a_parameter_hash);
     if ($a_parameter_hash['match_test'] != $LABELS_MATCHALLOF and $a_parameter_hash['match_test'] != $LABELS_MATCHANYOF and $a_parameter_hash['match_test'] != $LABELS_MATCHNONEOF) {
         throw new Exception("ZooomrPhotosetsRuleSetLabel: match_test not a recognised value");
     }
     if (!is_array($a_parameter_hash['labels'])) {
         throw new Exception("ZooomrPhotosetsRuleSetLabel: match_args must be an array");
     }
     $this->match_test = $a_parameter_hash['match_test'];
     $this->match_type = $PHOTOSETMATCH_LABEL;
     $this->match_args = join($a_parameter_hash['labels'], ",");
 }
 function ZooomrPhotosetsRuleSetPeopleTags($a_parameter_hash)
 {
     include 'Zooomr.Constants.php';
     $required_params = array('match_test', 'people_tags');
     ZooomrPhotosetsRuleSet::params_are_valid($required_params, null, $a_parameter_hash);
     if ($a_parameter_hash['match_test'] != $PEOPLETAG_MATCHALLOF and $a_parameter_hash['match_test'] != $PEOPLETAG_MATCHANYOF and $a_parameter_hash['match_test'] != $PEOPLETAG_MATCHNONEOF) {
         throw new Exception("ZooomrPhotosetsRuleSetPeopleTags: a_match constant not a recognised value");
     }
     if (!is_array($a_parameter_hash['people_tags'])) {
         throw new Exception("ZooomrPhotosetsRuleSetPeopleTags: match_args must be an array");
     }
     $this->match_test = $a_parameter_hash['match_test'];
     $this->match_type = $PHOTOSETMATCH_PEOPLETAG;
     $this->match_args = join(",", $a_parameter_hash['people_tags']);
 }
 function ZooomrPhotosetsRuleSetGeoTags($a_parameter_hash)
 {
     include 'Zooomr.Constants.php';
     $required_params = array('lat', 'lon');
     $optional_params = array('map_zooom_level');
     ZooomrPhotosetsRuleSet::params_are_valid($required_params, $optional_params, $a_parameter_hash);
     if (!array_key_exists('map_zoom_level', $a_parameter_hash)) {
         $a_parameter_hash['map_zoom_level'] = 3;
     }
     $params = array();
     $params = array_merge($params, $a_parameter_hash);
     $this->match_test = "0";
     # no match constant for GeoTags
     $this->match_type = $PHOTOSETMATCH_GEO;
     $this->match_args = "" . $a_parameter_hash['lat'] . "," . $a_parameter_hash['lon'] . "," . $a_parameter_hash['map_zooom_level'];
 }
Esempio n. 6
0
# notes
$note_doc = $zooomr->photos->notes->add(array('photo_id' => $first_photo_id, 'note_x' => "0", 'note_y' => "0", 'note_w' => "50", 'note_h' => "50", 'note_text' => "test note", 'auth_token' => $token));
get_user_input("Check that a note has been added to the first photo");
$note_doc = $note_doc->json_response;
$note_id = $note_doc->note->id;
$zooomr->photos->notes->edit(array('note_id' => $note_id, 'note_x' => "50", 'note_y' => "50", 'note_w' => "50", 'note_h' => "50", 'note_text' => "edited note text", 'auth_token' => $token));
get_user_input("Check that a note has been edited on the first photo");
$zooomr->photos->notes->delete(array('note_id' => $note_id, 'auth_token' => $token));
get_user_input("Check that a note has been removed from the first photo");
# transform
$zooomr->photos->transform->rotate(array('photo_id' => $first_photo_id, 'degrees' => "90", 'auth_token' => $token));
get_user_input("Check that a rotation has been applied to the first photo");
$zooomr->photos->transform->rotate(array('photo_id' => $first_photo_id, 'degrees' => "270", 'auth_token' => $token));
# photosets
# create a rule set object
$rule_set = new ZooomrPhotosetsRuleSet();
# create a label rule object
$label_rule = new ZooomrPhotosetsRuleSetLabels(array("match_test" => $LABELS_MATCHNONEOF, 'labels' => array("bluemonki")));
# create a views rule object
$view_rule = new ZooomrPhotosetsRuleSetViews(array('match_test' => $VIEWS_GREATERTHAN, 'views' => "100"));
# create a people tag rule
$peopletag_rule = new ZooomrPhotosetsRuleSetPeopleTags(array('match_test' => $PEOPLETAG_MATCHANYOF, 'people_tags' => array("bluemonki")));
# create a dateuploaded rule
$dateuploaded_rule = new ZooomrPhotosetsRuleSetDateUploaded(array('min_date' => $datetime100daysago));
# create a datetaken rule
$datetaken_rule = new ZooomrPhotosetsRuleSetDateTaken(array('min_date' => $datetime100daysago));
# create a geotags rule
$geotags_rule = new ZooomrPhotosetsRuleSetGeoTags(array('lat' => 51.3827, 'lon' => -2.7191));
# add the rules to the ruleset object
$rule_set->addRule(array('rule' => $label_rule));
$rule_set->addRule(array('rule' => $view_rule));