$form = new XTemplate('modules/DataSets/Layout_Popup_picker.html'); $GLOBALS['log']->debug("using file modules/DataSets/Layout_Popup_picker.html"); } else { $_REQUEST['html'] = preg_replace("/[^a-zA-Z0-9_]/", "", $_REQUEST['html']); $GLOBALS['log']->debug("_REQUEST['html'] is " . $_REQUEST['html']); $form = new XTemplate('modules/DataSets/' . $_REQUEST['html'] . '.html'); $GLOBALS['log']->debug("using file modules/DataSets/" . $_REQUEST['html'] . '.html'); } $form->assign("MOD", $mod_strings); $form->assign("APP", $app_strings); // the form key is required //if(!isset($_REQUEST['form'])) // sugar_die("Missing 'form' parameter"); // This code should always return an answer. // The form name should be made into a parameter and not be hard coded in this file. $focus = new DataSet_Layout(); if (isset($_REQUEST['layout_record'])) { $focus->retrieve($_REQUEST['layout_record']); //obtain the calc_id if it exists //Move this into the sub panel php files///////////////////////!!!!!!!!!!! $head_object = $focus->get_att_object("Head"); if (!empty($head_object->id) && $head_object->id != "") { $form->assign("MODIFY_HEAD", "checked"); $form->assign("TOGGLE_HEAD_START", "toggleDisplay('attheaddiv');"); $form->assign("HEAD_ATT_ID", $head_object->id); if ($head_object->display_type == "Scalar") { $form->assign("TOGGLE_SCALAR_START", "toggleDisplay('attheadscalardiv');"); } } $body_object = $focus->get_att_object("Body"); if (!empty($body_object->id) && $body_object->id != "") {
/********************************************************************************* * Description: ********************************************************************************/ global $app_strings; global $current_user; if (!is_admin($current_user)) { sugar_die($app_strings['LBL_UNAUTH_ADMIN']); } require_once 'modules/DataSets/DataSet_Layout.php'; require_once 'modules/DataSets/DataSet_Attribute.php'; require_once 'include/controller/Controller.php'; $is_update = false; $head_is_update = false; $body_is_update = false; $to_pdf = true; $focus = new DataSet_Layout(); if (!empty($_REQUEST['layout_id']) && $_REQUEST['layout_id'] != "") { $focus->retrieve($_REQUEST['layout_id']); $is_update = true; } //Update Data Set Layout Controller//////////////////////////////////////////// if ($is_update == true) { if (!empty($_REQUEST['direction'])) { $to_pdf = false; $controller = new Controller(); $magnitude = 1; $direction = $_REQUEST['direction']; $controller->init($focus, "Save"); $controller->change_component_order($magnitude, $direction, $focus->parent_id); } //End Update Data Set Layout Contoller
function modify_layout($column_name, $new_column_name) { $query = "\tSELECT dataset_layouts.id 'id'\n\t\t\t\t\tFROM dataset_layouts\n\t\t\t\t\tLEFT JOIN data_sets ON data_sets.id = dataset_layouts.parent_id\n\t\t\t\t\tWHERE data_sets.query_id = '" . $this->id . "'\n\t\t\t\t\tAND dataset_layouts.parent_value='" . $column_name . "'\n\t\t\t\t\tAND data_sets.custom_layout='Enabled'\n\t\t\t\t\tAND data_sets.deleted = '0'\n\t\t\t\t\t"; $result = $this->getSlaveDb()->query($query, true, "Error running query modify layout for column"); $GLOBALS['log']->debug("check custom binding modify layout: result is " . print_r($result, true)); //if($this->db->getRowCount($result) > 0){ //data sets exists with this query and custom layout enabled while (($row = $this->getSlaveDb()->fetchByAssoc($result)) != null) { $dataset_object = new DataSet_Layout(); $dataset_object->retrieve($row['id']); $dataset_object->parent_value = $new_column_name; $dataset_object->save(); //end while } //end if rows exist //} //end function modify_layout }
function get_layout_array($hide_columns = false) { $layout_object = new DataSet_Layout(); return $layout_object->get_layout_array($this->id, $hide_columns); //end function get_layout_array }