Example #1
0
 /**
  * Create new revision form.
  *
  * @param Page $page
  * @param int $copyRevisionId
  * @return Curry_Form
  */
 public static function getNewRevisionForm(Page $page, $copyRevisionId)
 {
     $pageRevisions = ArrayHelper::objectsToArray($page->getPageRevisions(), 'getPageRevisionId', 'getDescription');
     $pageRevisions = array(null => '[ None ]') + $pageRevisions;
     if ($page->getWorkingPageRevisionId()) {
         $pageRevisions[$page->getWorkingPageRevisionId()] .= " [working]";
     }
     if ($page->getActivePageRevisionId()) {
         $pageRevisions[$page->getActivePageRevisionId()] .= " [active]";
     }
     return new Curry_Form(array('action' => url('', array("module", "view", "page_id")), 'method' => 'post', 'class' => isAjax() ? 'dialog-form' : '', 'elements' => array('pid_createrevision' => array('hidden'), 'description' => array('text', array('label' => 'Name', 'required' => true, 'description' => 'Description of the revision')), 'copy_revision_id' => array('select', array('label' => 'Copy from revision', 'multiOptions' => $pageRevisions, 'description' => 'Copy content and templates from another revision.', 'value' => $copyRevisionId)), 'set_working' => array('checkbox', array('label' => 'Set as working revision', 'required' => true, 'value' => true)), 'createrevision' => array('submit', array('label' => 'Create new revision')))));
 }