Location: PHPKode > scripts > phpFlickrSynch > phpflickrsynch/backoffice/groups.php
	include '_include/header.php';

	<a href="./index.php">Manage photo albums</a> 
    <a href="./groups.php" class="selected">Manage photo groups</a>

<p class="introduction">Organize your photo albums into groups! In this screen, you can manage your groups: edit / add / delete.</p>

	$DB = new TableFlickrGroup();
	$ACTION = isset($_REQUEST['action']) ? $_REQUEST['action'] : NULL;	
	switch ($ACTION) {
		case 'ADDGROUP':
			$groupname = isset($_REQUEST['groupname']) ? trim($_REQUEST['groupname']) : NULL;
			if (strlen($groupname) > 0) {
				$id = $DB->createGroup($groupname);
				if ($id > 0) {
					echo '<div class="infoMsg"><div class="inner">Group created.</div></div>';
				} else {
					echo '<div class="warningMsg"><div class="inner">There was a problem when creating the group. Group not created.</div></div>';
			$groupid = isset($_REQUEST['groupid']) ? (integer)$_REQUEST['groupid'] : 0;
			if ($groupid > 0) {
				if ($DB->deleteGroup($groupid)) {
					echo '<div class="infoMsg"><div class="inner">Group deleted.</div></div>';
				} else {
					echo '<div class="warningMsg"><div class="inner">There was a problem when deleting the group. Group not deleted.</div></div>';

	$groups = $DB->getAllGroups();

<button type="button" id="addgroup"><span>Add group</span></button>

<div id="creategroup" style="display:none;" class="formadd">
	<form id="creategroupform" method="post" action="#">
    	<input type="hidden" name="action" value="ADDGROUP"/>
		<label for="groupname">Group name:</label>
		<input type="text" name="groupname" id="groupname"/>
		<button type="submit" class="action">Add group</button>
		<span id="creategroupcancel" class="link">Cancel</span>

<form id="deletegroupform" method="post" action="#">
<input type="hidden" name="action" value="DELETEGROUP"/>
<input type="hidden" name="groupid" id="deletegroupid" value="0"/>

	<th>Group name</th>
    <th style="width:50px">Actions</th>
	foreach ($groups as $key => $val) {
<tr id="group-<?php echo $val['id'];?>" class="photogrouprow">
	<td><span id="editgroupname-<?php echo $val['id'];?>"><?php echo $val['name'];?></span></td>
    <td><img src="_images/delete.png" width="16" height="16" alt="Delete this group" title="Delete this group" id="deletegroup-<?php echo $val['id'];?>" class="icon"/></td>

<script type="text/javascript">
var pa = new PhotoGroups();

	include '_include/footer.php';	
Return current item: phpFlickrSynch