<?
include_once(_DIR_EXT.'/HTML/c_page_XML_AJAX.php') ;
class c_page_ajax extends c_page_XML_AJAX
{

    function append_event_text()
    {   $obj_event=EVENTS()->get_event_obj_by_id($_POST['event_id']) ;
        $obj_event->reg_content_text($_POST['event_id'],$_POST['event_text']) ;
        EVENTS()->save_events($_POST['event_id'],array('message1'=>$_POST['event_text'])) ;
        $this->update_page=1 ;
    }

    function delete_media_content()
    {
        $obj_event=EVENTS()->get_event_obj_by_id($_POST['event_id']) ;
        $obj_event->delete_content($_POST['event_id'],$_POST['_check']) ;
        //damp_array($_POST) ;
        //$this->add_element('show_modal_window','HTML',array('title'=>'Прием документа','after_close_update_page'=>1,'width'=>'700px')) ;
        $this->update_page=1 ;

    }

    function save_media_content()
    {
        //$obj_event=EVENTS()->get_event_obj_by_id($_POST['event_id']) ;
        //damp_array($_POST) ;
        if (_sizeof($_POST['content'])) foreach($_POST['content'] as $content_id=>$data)
        {  $rec=array() ;
           if (isset($data['moment']))  $rec['moment']=$data['moment'] ;
           if (isset($data['len']))     $rec['len']=$data['len'] ;
           if (isset($data['manual']))  $rec['manual']=$data['manual'] ;
           if (_sizeof($rec)) update_rec_in_table('media_content',$rec,'pkey='.$content_id) ;
        }
        //$this->add_element('show_modal_window','HTML',array('title'=>'Прием документа','after_close_update_page'=>1,'width'=>'700px')) ;
        $this->update_page=1 ;

    }
}
