$access = get_input('access_id');\r
$tags = get_input('tidypicstags');\r
$subtype = get_input('subtype');\r
+ $cover = get_input('cover');\r
+ if (is_array($cover)) $cover = $cover[0];\r
\r
$container_guid = get_input('container_guid');\r
\r
}\r
\r
//if cover meta is sent from image save as metadata\r
- if ($subtype == 'image' && get_input('cover') == elgg_echo('album:cover:yes')) {\r
+ if ($subtype == 'image' && $cover == elgg_echo('album:cover')) {\r
$album = get_entity($container_guid); \r
$album->cover = $entity->guid;\r
}\r
+++ /dev/null
-<?php\r
-\r
- /**\r
- * Elgg custom checkbox input used to define an album cover \r
- * @ forms/edit.php\r
- * i made custom check box because the default checkboxes allows for more than one box.\r
- * it handles the checkboxes via arrays, but i only need one and i did not want to use time figuring it all out\r
- * simple and sweet , one checkbox.\r
- * \r
- * \r
- * @uses $vars['value'] The current value, if any\r
- * @uses $vars['js'] Any Javascript to enter into the input tag\r
- * @uses $vars['internalname'] The name of the input field\r
- * @uses $vars['options'] An array of strings representing the options for the checkbox field\r
- * \r
- */\r
-
- $class = $vars['class'];
- if (!$class) $class = "input-checkboxes";
-\r
- foreach($vars['options'] as $label => $option) {\r
-
- if ($option != $vars['value']) {\r
- $selected = "";\r
- } else {\r
- $selected = "checked = \"checked\"";\r
- }\r
-\r
- $labelint = (int) $label;\r
- if ("{$label}" == "{$labelint}") {\r
- $label = $option;\r
- }
-
- $disabled = "";
- if ($vars['disabled']) $disabled = ' disabled="yes" '; \r
- echo "<label><input type=\"checkbox\" $disabled {$vars['js']} name=\"{$vars['internalname']}\" {$selected} value=\"".htmlentities($option, null, 'UTF-8')."\" {$selected} class=\"$class\" />{$label}</label><br />";\r
- }\r
-\r
-?>
\ No newline at end of file
\r
<?php\r
if ($subtype == 'image') {\r
- // should this album be the cover for the album\r
- \r
- // try to determine if it is already the cover - the pass of this variable doesn't work - leave for next version\r
- $guid = $vars['entity']->guid;\r
$container_guid = $vars['entity']->container_guid;\r
- $cover_guid = get_entity($container_guid)->cover;\r
- if($cover_guid == $vars['entity']->guid)\r
- $cover = 'yes';\r
+ \r
+ // should this image be the cover for the album - only ask for non-cover photos\r
+ // determine if it is already the cover\r
+ $img_guid = $vars['entity']->guid;\r
+ $album = get_entity($container_guid);\r
+ $cover_guid = $album->cover;\r
+ \r
+ if ($cover_guid != $img_guid) { \r
\r
?>\r
<p>\r
- <label><?php echo elgg_echo("album:cover"); ?></label>\r
- <?php echo elgg_view("input/cover_checkbox", array( "internalname" => "cover", "value" => $cover, 'options' => array(elgg_echo('album:cover:yes')))); ?>\r
+<?php echo elgg_view('input/checkboxes', array('internalname' => "cover", \r
+ 'options' => array(elgg_echo("album:cover")),\r
+ ));\r
+?>\r
</p>\r
<?php\r
+ }\r
+ \r
} else {\r
// album so display access control\r
?>\r