Example #1
0
 public static function dropdown($data, $selected = NULL, $extra = '')
 {
     // standardize the $data as an array, strings default to the class_type
     if (!is_array($data)) {
         $data = array('name' => $data);
     }
     // add in all the defaults if they are not provided
     $defaults = array('nullOption' => FALSE);
     $data = arr::merge($defaults, $data);
     $options = MediaFile::catalog();
     if ($data['nullOption']) {
         array_unshift($options, $data['nullOption']);
     }
     $data = array_diff($data, $defaults);
     // use kohana helper to generate the markup
     return form::dropdown($data, $options, $selected, $extra);
 }
Example #2
0
 public function qtipAjaxReturn($data)
 {
     if ($data instanceof MediaFile) {
         $hide_rate = kohana::config('mediafile.hide_rate_folders');
         $id = $data->filepath(TRUE, !$hide_rate);
         $catalog = MediaFile::catalog();
         $value = $catalog[$id];
         jquery::addPlugin('growl');
         Session::instance()->get_once('bluebox_message', array());
         javascript::codeBlock('
             $(\'#media_widget_file_list\')
                 .prepend($("<option></option>")
                 .attr("selected", "selected")
                 .attr("value", "' . $id . '")
                 .text("' . $value . '"))
                 .trigger("change");
         ');
     }
     parent::qtipAjaxReturn($data);
 }