}
exit;
break;
+case 'search':
+ try {
+ $search_result = $repo->search($search_text);
+ $search_result['search_result'] = true;
+ $search_result['repo_id'] = $repo_id;
+ echo '<table>';
+ foreach ($search_result['list'] as $item) {
+ echo '<tr>';
+ echo '<td><img src="'.$item['thumbnail'].'" />';
+ echo '</td><td>';
+ if (!empty($item['url'])) {
+ echo '<a href="'.$item['url'].'" target="_blank">'.$item['title'].'</a>';
+ } else {
+ echo $item['title'];
+ }
+ echo '</td>';
+ echo '<td>';
+ if (!isset($item['children'])) {
+ echo '<form method="post">';
+ echo '<input type="hidden" name="file" value="'.$item['source'].'"/>';
+ echo '<input type="hidden" name="action" value="confirm"/>';
+ echo '<input type="hidden" name="title" value="'.$item['title'].'"/>';
+ echo '<input type="hidden" name="icon" value="'.$item['thumbnail'].'"/>';
+ echo '<input type="submit" value="'.get_string('select','repository').'" />';
+ echo '</form>';
+ } else {
+ echo '<form method="post">';
+ echo '<input type="hidden" name="p" value="'.$item['path'].'"/>';
+ echo '<input type="submit" value="'.get_string('enter', 'repository').'" />';
+ echo '</form>';
+ }
+ echo '</td>';
+ echo '<td width="100px" align="center">';
+ echo '</td>';
+ echo '</td></tr>';
+ }
+ echo '</table>';
+ } catch (repository_exception $e) {
+ }
+ break;
case 'list':
case 'sign':
print_header();
}
} else {
echo '<form method="post">';
- $repo->print_login();
echo '<input type="hidden" name="action" value="sign" />';
echo '<input type="hidden" name="repo_id" value="'.$repo_id.'" />';
+ $repo->print_login();
echo '</form>';
}
print_footer('empty');
* @param boolean $ajax
* @return array
*/
- public function print_login($ajax = true) {
- if ($ajax) {
+ public function print_login() {
+ if ($this->options['ajax']) {
$ret = array();
$fulltext = new stdclass;
$fulltext->label = get_string('fulltext', 'repository_flickr_public').': ';
$ret['login_btn_label'] = get_string('search');
$ret['login_btn_action'] = 'search';
return $ret;
+ } else {
+ echo '<table>';
+ echo '<tr><td><label>'.get_string('fulltext', 'repository_flickr_public').'</label></td>';
+ echo '<td><input type="text" name="flickr_fulltext" /></td></tr>';
+ echo '<tr><td><label>'.get_string('tag', 'repository_flickr_public').'</label></td>';
+ echo '<td><input type="text" name="flickr_tag" /></td></tr>';
+ echo '<tr><td><label>'.get_string('username', 'repository_flickr_public').'</label></td>';
+ echo '<td><input type="text" name="flickr_account" /></td></tr>';
+
+ echo '<tr><td><label>'.get_string('license', 'repository_flickr_public').'</label></td>';
+ echo '<td>';
+ echo '<input type="radio" name="flickr_license" value="all" /> '.get_string('all', 'repository_flickr_public');
+ echo '<br />';
+ echo '<input type="radio" name="flickr_license" value="1" /> '.get_string('by-nc-sa', 'repository_flickr_public');
+ echo '<br />';
+ echo '<input type="radio" name="flickr_license" value="2" /> '.get_string('by-nc', 'repository_flickr_public');
+ echo '<br />';
+ echo '<input type="radio" name="flickr_license" value="3" /> '.get_string('by-nc-nd', 'repository_flickr_public');
+ echo '<br />';
+ echo '<input type="radio" name="flickr_license" value="4" /> '.get_string('by', 'repository_flickr_public');
+ echo '<br />';
+ echo '<input type="radio" name="flickr_license" value="5" /> '.get_string('by-sa', 'repository_flickr_public');
+ echo '<br />';
+ echo '<input type="radio" name="flickr_license" value="6" /> '.get_string('by-nd', 'repository_flickr_public');
+ echo '</td></tr>';
+
+ echo '</table>';
+
+ echo '<input type="hidden" name="action" value="search" />';
+ echo '<input type="submit" value="Search" />';
}
}