repository/flickr_public MDL-15488 Make the search form a lot simpler and friendlier

This commit is contained in:
Martin Dougiamas 2009-12-02 13:01:58 +00:00
parent 5363905a51
commit 640bb8c1b6
2 changed files with 14 additions and 31 deletions

View File

@ -10,15 +10,15 @@ $string['by-nc-nd'] = 'Attribution-NonCommercial-NoDerivs License';
$string['by'] = 'Attribution License';
$string['by-sa'] = 'Attribution-ShareAlike License';
$string['by-nd'] = 'Attribution-NoDerivs License';
$string['commercialuse'] = 'Allow commercial uses of your work?';
$string['commercialuse'] = 'I want to be able to use the images commercially';
$string['creativecommonscommercial'] = 'Only creative commons commercial';
$string['emailaddress'] = 'Email address';
$string['fulltext'] = 'Full text';
$string['flickr_public:view'] = 'View flickr_public repository';
$string['information'] = '<div>Get <a href=\"http://www.flickr.com/services/api/keys/\">Flickr API Key</a> for your Moodle site. </div>';
$string['information'] = '<div>Get a <a href=\"http://www.flickr.com/services/api/keys/\">Flickr API Key</a> for your Moodle site. </div>';
$string['invalidemail'] = 'Invalid email account for flickr';
$string['license'] = 'License';
$string['modification'] = 'Allow modifications of your work?';
$string['modification'] = 'I want to be able to modify the images';
$string['notitle'] = 'notitle';
$string['nullphotolist'] = 'There are no photos in this account';
$string['tag'] = 'Tag';
@ -28,5 +28,5 @@ $string['repositorydesc'] = 'Repository on flickr.com';
$string['secret'] = 'Secret';
$string['sharealike'] = 'Yes, as long as others share alike';
$string['username'] = 'Flickr account email';
$string['watermark'] = 'Add watermark (Author ID and original URL) to downloaed photos?';
$string['watermark'] = 'Add watermark to photos (Author and URL)';

View File

@ -131,25 +131,16 @@ class repository_flickr_public extends repository {
$commercial = new stdclass;
$commercial->label = get_string('commercialuse', 'repository_flickr_public').': ';
$commercial->id = 'flickr_commercial_id';
$commercial->type = 'radio';
$commercial->type = 'checkbox';
$commercial->name = 'flickr_commercial';
$commercial->value = implode('|', array('yes', 'no'));
$commercial->value_label = implode('|', array(
get_string('yes'),
get_string('no')
));
$commercial->value = 'yes';
$modification = new stdclass;
$modification->label = get_string('modification', 'repository_flickr_public').': ';
$modification->id = 'flickr_modification_id';
$modification->type = 'radio';
$modification->type = 'checkbox';
$modification->name = 'flickr_modification';
$modification->value = implode('|', array('yes', 'sharealike', 'no'));
$modification->value_label = implode('|', array(
get_string('yes'),
get_string('sharealike', 'repository_flickr_public'),
get_string('no')
));
$modification->value = 'yes';
$ret['login'] = array($fulltext, $tag, $email_field, $commercial, $modification);
$ret['login_btn_label'] = get_string('search');
@ -166,20 +157,12 @@ class repository_flickr_public extends repository {
echo '<tr><td><label>'.get_string('commercialuse', 'repository_flickr_public').'</label></td>';
echo '<td>';
echo '<input type="radio" name="flickr_commercial" value="yes" /> '.get_string('yes');
echo '<br />';
echo '<input type="radio" name="flickr_commercial" value="no" /> '.get_string('no');
echo '<br />';
echo '<input type="checkbox" name="flickr_commercial" value="yes" />';
echo '</td></tr>';
echo '<tr><td><label>'.get_string('modification', 'repository_flickr_public').'</label></td>';
echo '<td>';
echo '<input type="radio" name="flickr_modification" value="yes" /> '.get_string('yes');
echo '<br />';
echo '<input type="radio" name="flickr_modification" value="sharealike" /> '.get_string('sharealike', 'repository_flickr_public');
echo '<br />';
echo '<input type="radio" name="flickr_modification" value="no" /> '.get_string('no');
echo '<br />';
echo '<input type="checkbox" name="flickr_modification" value="yes" />';
echo '</td></tr>';
echo '</table>';
@ -254,18 +237,18 @@ class repository_flickr_public extends repository {
// 7: unknown license
unset($licenses[3], $licenses[6]);
}
if ($modification == 'sharealike') {
//if ($modification == 'sharealike') {
// including
// 1: Attribution NonCommercial ShareAlike
// 5: Attribution ShareAlike
unset($licenses[2], $licenses[3], $licenses[4], $licenses[6], $licenses[7]);
}
//unset($licenses[2], $licenses[3], $licenses[4], $licenses[6], $licenses[7]);
//}
$licenses = implode(',', $licenses);
if (!empty($SESSION->{$this->sess_tag}) // use tag to search
or !empty($SESSION->{$this->sess_text}) // use keyword to search
or !empty($this->nsid)/*use pre-defined accound*/) {
or !empty($this->nsid)/*use pre-defined accound*/) {
$photos = $this->flickr->photos_search(array(
'tags'=>$SESSION->{$this->sess_tag},
'page'=>$page,