/**
  * Returns the instance of the controller.
  *
  * @return the instance of the controller object
  */
 public static function Get_instance()
 {
     if (!self::$Instance) {
         $class = __CLASS__;
         self::$Instance = new $class(false);
     }
     return self::$Instance;
 }
Exemplo n.º 2
0
<?php

require_once 'PagePartFormsController.php';
PagePartFormsController::Init();
function page_part_forms_name_to_id($name)
{
    // XXX: There may be more chars to replace
    return PagePartFormsController::CSS_ID_PREFIX . "Page-Part-" . strtr($name, " _", "--");
}
function page_part_forms_dump_hash_delegate($key, $value)
{
    return '"' . $key . '": "' . $value . '"';
}
Exemplo n.º 3
0
             foreach ($values as $value) {
                 echo '<option value="' . $value . '"' . (array_key_exists($value, $multiple_values) ? 'selected="selected"' : '') . '>' . $value . '</option>';
             }
             echo '</select>';
             break;
         case PagePartFormsController::SELECT_TYPE_RADIO:
             foreach ($structure[$name][PagePartFormsController::PROPERTY_VALUES] as $value) {
                 echo '<span class="' . $css_class_prefix . 'part-radio">';
                 // NOTE: if changed back from many to one for this page_part, no value will be selected.
                 echo '<input type="radio" ' . ($content == $value ? 'checked="checked"' : '') . ' name="' . $field_name_content . '" value="' . $value . '" />' . $value;
                 echo '</span>' . PHP_EOL;
             }
             break;
         case PagePartFormsController::SELECT_TYPE_CHECKBOX:
             echo '<textarea style="display: none;" name="' . $field_name_content . '" rows="1" cols="1">' . $content . '</textarea>';
             $multiple_values = PagePartFormsController::Get_multiple_values($content);
             foreach ($structure[$name][PagePartFormsController::PROPERTY_VALUES] as $value) {
                 echo '<span class="' . $css_class_prefix . 'part-checkbox">';
                 // NOTE: Frog can only handle simple strings as values instead of arrays. Use javascript to create a string out of the selected items
                 echo '<input type="checkbox" ' . (array_key_exists($value, $multiple_values) ? 'checked="checked"' : '') . ' name="' . $plugin_id . '_values_for_' . $name . '" value="' . $value . '" />' . $value;
                 echo '</span>' . PHP_EOL;
             }
             // Add node information for multiple options
             array_push($multiple_content, array('title' => $title, 'content' => $field_name_content, 'name' => $name, 'limit' => $limit));
             break;
     }
     echo '</div>';
     break;
 case PagePartFormsController::TYPE_DATE:
     echo '<span class="' . $css_class_prefix . 'part-date">';
     echo '<input type="text" name="' . $field_name_content . '" size="10" maxlength="10" value="' . $content . '" />';