protected function do_actions()
 {
     $this->set_return_message('edited note');
     $this->get_variables = array();
     /*
      * The $_POST
      */
     if (isset($_POST['edit_note']) && isset($_POST['note_id']) && isset($_POST['note_text'])) {
         Oedipus_NotesHelper::set_note_text($_POST['note_id'], $_POST['note_text']);
     } elseif (isset($_POST['add_note']) && isset($_POST['frame_id'])) {
         $frame = Oedipus_DramaHelper::get_frame_by_id($_POST['frame_id']);
         if (isset($_POST['note_text'])) {
             Oedipus_NotesHelper::add_note_to_frame($frame, $_POST['note_text']);
         }
     }
     /*
      * The $_GET
      */
     if (isset($_POST['drama_id'])) {
         $this->get_variables['drama_id'] = $_POST['drama_id'];
     }
     if (isset($_POST['frame_id'])) {
         $this->get_variables['frame_id'] = $_POST['frame_id'];
     }
     $return_to_url = $this->get_return_to_url();
     $this->set_return_to_url($return_to_url);
 }
 protected function do_actions()
 {
     //                print_r($_POST);exit;
     $return_to_url = $this->get_redirect_script_return_url();
     if (isset($_POST['new_drama']) && isset($_POST['user_id'])) {
         if (isset($_POST['drama_name'])) {
             $drama_name = $_POST['drama_name'];
         } else {
             $drama_name = Oedipus_DramaHelper::get_new_drama_name();
         }
         $drama = Oedipus_DramaHelper::add_drama($drama_name, $_POST['user_id']);
         // A drama needs at least one act and an act, one scene.
         $act = Oedipus_DramaHelper::add_act($drama);
         $scene = Oedipus_DramaHelper::add_scene($act);
         $scene_note = Oedipus_NotesHelper::add_note_to_scene_with_default_content($scene);
         $frame = Oedipus_DramaHelper::add_frame($scene, 'Frame 1', '0');
         $frame_note = Oedipus_NotesHelper::add_note_to_frame_with_default_content($frame);
         $return_to_url = Oedipus_DramaHelper::get_drama_page_url_for_drama($drama);
     } elseif (isset($_GET['add_act']) && isset($_GET['drama_id'])) {
         $drama = Oedipus_DramaHelper::get_drama_by_id($_GET['drama_id']);
         // an act, one scene.
         $act = Oedipus_DramaHelper::add_act($drama);
         $scene = Oedipus_DramaHelper::add_scene($act);
         $scene_note = Oedipus_NotesHelper::add_note_to_scene_with_default_content($scene);
         $frame = Oedipus_DramaHelper::add_frame($scene, 'Frame 1', '0');
         $frame_note = Oedipus_NotesHelper::add_note_to_frame_with_default_content($frame);
         $return_to_url = Oedipus_DramaHelper::get_drama_page_url_for_act_id($act->get_id());
     } elseif (isset($_POST['edit_drama_status']) && isset($_POST['status']) && isset($_POST['drama_id'])) {
         Oedipus_DramaHelper::set_drama_status($_POST['drama_id'], $_POST['status']);
         $return_to_url = Oedipus_DramaHelper::get_share_drama_url_for_drama_id($_POST['drama_id']);
     }
     $this->set_return_to_url($return_to_url);
 }
 protected function do_actions()
 {
     //                print_r($_POST);exit;
     $return_to_url = $this->get_redirect_script_return_url();
     if (isset($_GET['add_scene']) && isset($_GET['act_id'])) {
         $act = Oedipus_DramaHelper::get_act_by_id($_GET['act_id']);
         // an act, one scene.
         $scene = Oedipus_DramaHelper::add_scene($act);
         $scene_note = Oedipus_NotesHelper::add_note_to_scene_with_default_content($scene);
         $frame = Oedipus_DramaHelper::add_frame($scene, 'First frame', '0');
         $frame_note = Oedipus_NotesHelper::add_note_to_frame_with_default_content($frame);
         $return_to_url = Oedipus_DramaHelper::get_drama_page_url_for_scene_id($scene->get_id());
     }
     $this->set_return_to_url($return_to_url);
 }
 private function add_frame($scene_id, $frame_name, $parent_frame_id)
 {
     /*
      * Get the scene
      */
     $scene = Oedipus_DramaHelper::get_scene_by_id($scene_id);
     /*
      * Add a default frame to the scene
      */
     $frame = Oedipus_DramaHelper::add_frame($scene, $frame_name, $parent_frame_id);
     /*
      * Add a default note for the frame
      */
     $note = Oedipus_NotesHelper::add_note_to_frame_with_default_content($frame);
     return $frame;
 }
 public static function get_scene_notes_div(Oedipus_Scene $scene)
 {
     $div = new HTMLTags_Div();
     $div->set_attribute_str('class', 'notes');
     $div->set_attribute_str('id', 'scene');
     /*
      * Put A Textbox for the heading if scene is editable,
      * Put a <h3> if it isn't
      */
     if ($scene->is_editable()) {
         $name_div = new HTMLTags_Div();
         $name_div->set_attribute_str('id', 'name-form');
         $name_div->append(new Oedipus_EditSceneNameHTMLForm($scene));
         $div->append($name_div);
     } else {
         $div->append($heading = new HTMLTags_Heading(3, $scene->get_name()));
     }
     /*
      * Put a Textbox for the Note, if frame is editable,
      * Put the note in a <pre> if it isn't
      */
     try {
         if ($scene->is_editable()) {
             $drama_id = Oedipus_DramaHelper::get_drama_id_for_scene_id($scene->get_id());
             $note_div = new HTMLTags_Div();
             $note_div->set_attribute_str('id', 'note-form');
             $note_div->set_attribute_str('class', 'user-html');
             if (Oedipus_NotesHelper::has_scene_got_note($scene->get_id())) {
                 $note = Oedipus_NotesHelper::get_note_by_scene_id($scene->get_id());
                 $note_div->append(self::get_note_preview_div($note));
                 $note_div->append(new Oedipus_EditSceneNoteHTMLForm($note, $drama_id, $scene->get_id()));
             } else {
                 $note_div->append(new Oedipus_AddSceneNoteHTMLForm($drama_id, $scene));
             }
             $div->append($note_div);
         } else {
             $note = Oedipus_NotesHelper::get_note_by_scene_id($scene->get_id());
             $user_html_div = new HTMLTags_Div();
             $user_html_div->set_attribute_str('class', 'user-html');
             $user_html_div->append($note->get_note_text_html());
             $div->append($user_html_div);
         }
     } catch (Exception $e) {
         throw new Exception('Failed to retrieve note');
     }
     return $div;
 }
 public static function get_scene_notes_div(Oedipus_Scene $scene)
 {
     return Oedipus_NotesHelper::get_scene_notes_div($scene);
 }
 private function get_frame_notes_div()
 {
     $div = new HTMLTags_Div();
     $div->set_attribute_str('class', 'notes');
     /*
      * Put A Textbox for the heading if frame is editable,
      * Put a <h3> if it isn't
      */
     if ($this->frame->is_editable()) {
         $name_div = new HTMLTags_Div();
         $name_div->set_attribute_str('id', 'name-form');
         $name_div->append(new Oedipus_EditFrameNameHTMLForm($this->frame));
         $div->append($name_div);
     } else {
         $div->append($heading = new HTMLTags_Heading(3, $this->frame->get_name()));
     }
     /*
      * Put a Textbox for the Note, if frame is editable,
      * Put the note in a <pre> if it isn't
      */
     try {
         if ($this->frame->is_editable()) {
             $drama_id = $this->frame->get_drama_id();
             $note_div = new HTMLTags_Div();
             $note_div->set_attribute_str('id', 'note-form');
             $note_div->set_attribute_str('class', 'user-html');
             if (Oedipus_NotesHelper::has_frame_got_note($this->frame->get_id())) {
                 $note = Oedipus_NotesHelper::get_note_by_frame_id($this->frame->get_id());
                 $note_div->append(Oedipus_NotesHelper::get_note_preview_div($note));
                 $note_div->append(new Oedipus_EditFrameNoteHTMLForm($note, $drama_id, $this->frame->get_id()));
             } else {
                 $note_div->append(new Oedipus_AddFrameNoteHTMLForm($drama_id, $this->frame));
             }
             $div->append($note_div);
         } else {
             $note = Oedipus_NotesHelper::get_note_by_frame_id($this->frame->get_id());
             //print_r($note);exit;
             $user_html_div = new HTMLTags_Div();
             $user_html_div->set_attribute_str('class', 'user-html');
             $user_html_div->append($note->get_note_text_html());
             $div->append($user_html_div);
         }
     } catch (Exception $e) {
         throw new Exception('Failed to retrieve note');
     }
     return $div;
 }