aboutsummaryrefslogtreecommitdiff
path: root/includes/preset.inc
diff options
context:
space:
mode:
authorHeshan Wanigasooriya <heshanmw@gmail.com>2011-02-21 09:31:51 +0000
committerHeshan Wanigasooriya <heshanmw@gmail.com>2011-02-21 09:31:51 +0000
commitf005859eec16dad0594bedd9593a8537bbda6e1b (patch)
tree72032796dc9a4c89c24159163dd8c3e029138c3d /includes/preset.inc
parent76913b8b151e4b9e85f0fae20854ed8a9202c3fd (diff)
downloadvideo-f005859eec16dad0594bedd9593a8537bbda6e1b.tar.gz
video-f005859eec16dad0594bedd9593a8537bbda6e1b.tar.bz2
Adding dependencies on the Preset module and added all presets are editable from the admin interface
Diffstat (limited to 'includes/preset.inc')
-rw-r--r--includes/preset.inc98
1 files changed, 24 insertions, 74 deletions
diff --git a/includes/preset.inc b/includes/preset.inc
index 1b0f6c4..fe9a7e4 100644
--- a/includes/preset.inc
+++ b/includes/preset.inc
@@ -9,47 +9,32 @@
class video_preset {
- private $presets;
+ private $preset;
public function __construct($preset = null) {
- $this->presets = $preset;
+ $this->preset = $preset;
if (!isset($preset))
- $this->presets = variable_get('vid_preset', '');
-//get our configured transcoder.
-// if (!isset($preset))
-// $preset = variable_get('vid_preset', 'flash_hq');
-// echo print_r($preset);
-// if (!module_load_include('inc', 'video', '/video_preset/' . $preset)) {
-// $modules = module_list();
-// foreach ($modules as $module) {
-// $mobule_files = array();
-// $module_path = drupal_get_path('module', $module) . '/video_preset';
-// $mobule_files = file_scan_directory($module_path, '^.*\.inc$');
-// if (is_array($mobule_files)) {
-// foreach ($mobule_files as $file) {
-// if ($file->name == $preset)
-// require_once $file->filename;
-// }
-// }
-////
-// }
-// }
-// if (class_exists($preset)) {
-// $this->preset = new $preset;
-// } else {
-// drupal_set_message(t('The preset is not configured properly.'), 'error');
-// }
+ $this->preset = variable_get('video_preset', array());
}
+ /**
+ * Show admin settings
+ * @return array $form
+ */
public function admin_settings() {
+ $presets = preset_get_presets('video');
+ $preset = array();
+ foreach ($presets as $id => $value) {
+ $preset[$id] = $value['name'];
+ $help[] = $value['name'] . ' - ' . $value['description'] . ' ' . l(t('edit'), preset_get_preset_path('video', $value['name']));
+ }
$form = array();
- $options = $this->_preset();
- $form['vid_preset'] = array(
+ $form['video_preset'] = array(
'#type' => 'checkboxes',
'#title' => t('Video transcode presets'),
- '#options' => $options['radios'],
- '#default_value' => variable_get('vid_preset', array('status', 'promote')),
- '#description' => t('!list', array('!list' => theme('item_list', $options['help']))),
+ '#options' => $preset,
+ '#default_value' => variable_get('video_preset', array()),
+ '#description' => t('!list', array('!list' => theme('item_list', array('items' => $help)))),
'#prefix' => '<div id="preset-checkboxes">',
'#suffix' => '</div>',
);
@@ -57,50 +42,15 @@ class video_preset {
return $form;
}
- private function _preset($presets = null) {
-// @TDOO : Observer will match in this case
- $files = array();
-// Lets find our transcoder classes and build our radio options
-// We do this by scanning our transcoders folder
- $form = array('radios' => array(), 'help' => array(), 'properties' => array());
- $path = drupal_get_path('module', 'video') . '/video_preset';
- $files = file_scan_directory($path, '/.*\.inc/');
-// check inside sub modules
- $modules = module_list();
- foreach ($modules as $module) {
- $mobule_files = array();
- $module_path = drupal_get_path('module', $module) . '/video_preset';
- $mobule_files = file_scan_directory($module_path, '/.*\.inc/');
- $files = array_merge($files, $mobule_files);
- }
-
- foreach ($files as $file) {
- if (!module_load_include('inc', 'video', '/video_preset/' . $file->name))
- require_once $file->filename;
- $focus = new $file->name;
- $form['radios'][$focus->get_value()] = $focus->get_name();
- $form['help'][] = $focus->get_help();
-// $form['admin_settings'] = $form['admin_settings'] + $focus->admin_settings();
- if (is_array($presets) && !empty($presets[$focus->get_value()]))
- $form['properties'][$focus->get_value()] = $focus->get_properties();
-// echo $focus->get_value();
- }
- return $form;
- }
-
+ /**
+ * Get the preset properties
+ * @return array $properties
+ */
public function properties() {
- $presets = $this->presets;
- $options = $this->_preset($presets);
+ $preset = $this->preset;
return $options['properties'];
+ if (preset_exists('video', $preset))
+ preset_get_settings($preset);
}
-}
-
-interface video_preset_interface {
-
- public function get_name();
-
- public function get_help();
-
- public function get_properties();
} \ No newline at end of file