<?php

/**
 * $Id: ajax_edit_ex_picture.php 26570 2014-12-24 10:56:29Z phenxdesign $
 *
 * @package    Mediboard
 * @subpackage forms
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 26570 $
 */
CCanDo::checkEdit();
$ex_picture_id = CValue::get("ex_picture_id");
$ex_group_id = CValue::get("ex_group_id");
CExObject::$_locales_cache_enabled = false;
$ex_group = new CExClassFieldGroup();
$ex_group->load($ex_group_id);
$ex_picture = new CExClassPicture();
if ($ex_picture->load($ex_picture_id)) {
    $ex_picture->loadRefsNotes();
} else {
    $ex_picture->ex_group_id = $ex_group_id;
    $ex_picture->disabled = "0";
}
$ex_picture->loadRefPredicate()->loadView();
$ex_picture->loadRefExClass();
$ex_picture->loadRefFile();
$smarty = new CSmartyDP();
$smarty->assign("ex_picture", $ex_picture);
$smarty->assign("ex_group", $ex_group);
$smarty->display("inc_edit_ex_picture.tpl");
 /**
  * @see parent::store()
  */
 function store()
 {
     CExObject::$_locales_cache_enabled = false;
     if ($msg = parent::store()) {
         return $msg;
     }
     if ($this->_compute_view) {
         $this->loadView();
     }
     return null;
 }
 /**
  * @see parent::loadEditView()
  */
 function loadEditView()
 {
     parent::loadEditView();
     CExObject::initLocales();
     CExObject::$_locales_cache_enabled = false;
     if ($this->pixel_positionning) {
         $grid = null;
         $out_of_grid = null;
         $this->getPixelGrid();
         foreach ($this->_ref_groups as $_ex_group) {
             $_ex_group->loadRefsSubgroups(true);
             $_ex_group->loadRefsPictures(true);
             $_subgroups = $_ex_group->loadRefsSubgroups(true);
             foreach ($_subgroups as $_subgroup) {
                 $_subgroup->countBackRefs("children_groups");
                 $_subgroup->countBackRefs("children_fields");
                 $_subgroup->countBackRefs("children_messages");
             }
         }
     } else {
         list($grid, $out_of_grid) = $this->getGrid(4, 40, false);
     }
     $events = $this->loadRefsEvents();
     foreach ($events as $_event) {
         $_event->countBackRefs("constraints");
     }
     $this->_groups = CGroups::loadGroups();
     $this->_ex_object = $this->getExObjectInstance();
     $this->_grid = $grid;
     $this->_out_of_grid = $out_of_grid;
     if (!$this->_id) {
         $this->group_id = CGroups::loadCurrent()->_id;
     }
     $classes = CExClassEvent::getReportableClasses();
     $instances = array();
     foreach ($classes as $_class) {
         $instances[$_class] = new $_class();
     }
     $this->_host_objects = $instances;
     $category = new CExClassCategory();
     $this->_categories = $category->loadList(null, "title");
 }