/** * Show an upload form to restore a database dump file */ public function RestoreForm() { $response = new ResponseManager(); if (Config::GetSetting('SETTING_IMPORT_ENABLED') != 'On') { trigger_error(__('Sorry this function is disabled.'), E_USER_ERROR); } // Check we have permission to do this if ($this->user->usertypeid != 1) { trigger_error(__('Only an adminitrator can import a database')); } $msgDumpFile = __('Backup File'); $msgWarn = __('Warning: Importing a file here will overwrite your existing database. This action cannot be reversed.'); $msgMore = __('Select a file to import and then click the import button below. You will be taken to another page where the file will be imported.'); $msgInfo = __('Please note: The folder location for mysqldump must be available in your path environment variable for this to work and the php "exec" command must be enabled.'); $form = <<<FORM <p>{$msgWarn}</p> <p>{$msgInfo}</p> <form id="file_upload" method="post" action="index.php?p=admin&q=RestoreDatabase" enctype="multipart/form-data"> <table> <tr> <td><label for="file">{$msgDumpFile}<span class="required">*</span></label></td> <td> <input type="file" name="dumpFile" /> </td> </tr> </table> </form> <p>{$msgMore}</p> FORM; $response->SetFormRequestResponse($form, __('Import Database Backup'), '550px', '375px'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Import'), '$("#file_upload").submit()'); $response->Respond(); }
/** * Permissions form */ public function PermissionsForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $helpManager = new HelpManager($db, $user); if (!$this->auth->modifyPermissions) { trigger_error(__('You do not have permissions to edit this media'), E_USER_ERROR); } // List of all Groups with a view / edit / delete check box $permissions = new UserGroup(); if ($this->assignedMedia) { if (!($result = $permissions->GetPermissionsForObject('lklayoutmediagroup', NULL, NULL, sprintf(" AND lklayoutmediagroup.MediaID = '%s' AND lklayoutmediagroup.RegionID = '%s' AND lklayoutmediagroup.LayoutID = %d ", $this->mediaid, $this->regionid, $this->layoutid)))) { trigger_error($permissions->GetErrorMessage(), E_USER_ERROR); } } else { if (!($result = $permissions->GetPermissionsForObject('lkmediagroup', 'MediaID', $this->mediaid))) { trigger_error($permissions->GetErrorMessage(), E_USER_ERROR); } } if (count($result) <= 0) { trigger_error(__('Unable to get permissions'), E_USER_ERROR); } $checkboxes = array(); foreach ($result as $row) { $groupId = $row['groupid']; $rowClass = $row['isuserspecific'] == 0 ? 'strong_text' : ''; $checkbox = array('id' => $groupId, 'name' => Kit::ValidateParam($row['group'], _STRING), 'class' => $rowClass, 'value_view' => $groupId . '_view', 'value_view_checked' => $row['view'] == 1 ? 'checked' : '', 'value_edit' => $groupId . '_edit', 'value_edit_checked' => $row['edit'] == 1 ? 'checked' : '', 'value_del' => $groupId . '_del', 'value_del_checked' => $row['del'] == 1 ? 'checked' : ''); $checkboxes[] = $checkbox; } $formFields = array(); $formFields[] = FormManager::AddPermissions('groupids[]', $checkboxes); Theme::Set('form_fields', $formFields); // Set some information about the form Theme::Set('form_id', 'LayoutPermissionsForm'); Theme::Set('form_action', 'index.php?p=module&mod=' . $this->type . '&q=Exec&method=Permissions'); Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $this->layoutid . '" /><input type="hidden" name="regionid" value="' . $this->regionid . '" /><input type="hidden" name="mediaid" value="' . $this->mediaid . '" />'); $response->SetFormRequestResponse(NULL, __('Permissions'), '350px', '500px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . ($this->layoutid != 0 ? $helpManager->Link('LayoutMedia', 'Permissions') : $helpManager->Link('Media', 'Permissions')) . '")'); if ($this->assignedMedia) { $response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=timeline&layoutid=' . $this->layoutid . '®ionid=' . $this->regionid . '&q=RegionOptions")'); } else { $response->AddButton(__('Cancel'), 'XiboDialogClose()'); } $response->AddButton(__('Save'), '$("#LayoutPermissionsForm").submit()'); return $response; }
/** * Shows the Delete Group Form */ function DeleteForm() { $displayProfile = new DisplayProfile(); $displayProfile->displayProfileId = Kit::GetParam('displayprofileid', _GET, _INT); if (!$displayProfile->Load()) { trigger_error($displayProfile->GetErrorMessage(), E_USER_ERROR); } if ($this->user->usertypeid != 1 && $this->user->userid != $displayProfile->userId) { trigger_error(__('You do not have permission to edit this profile'), E_USER_ERROR); } // Set some information about the form Theme::Set('form_id', 'DisplayProfileDeleteForm'); Theme::Set('form_action', 'index.php?p=displayprofile&q=Delete'); Theme::Set('form_meta', '<input type="hidden" name="displayprofileid" value="' . $displayProfile->displayProfileId . '" />'); Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to delete?')))); $response = new ResponseManager(); $response->SetFormRequestResponse(NULL, __('Delete Display Profile'), '350px', '175px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('DisplayProfile', 'Delete') . '")'); $response->AddButton(__('No'), 'XiboDialogClose()'); $response->AddButton(__('Yes'), '$("#DisplayProfileDeleteForm").submit()'); $response->Respond(); }
public function ImportForm() { global $session; $db =& $this->db; $response = new ResponseManager(); // Set the Session / Security information $sessionId = session_id(); $securityToken = CreateFormToken(); $session->setSecurityToken($securityToken); // Find the max file size $maxFileSizeBytes = convertBytes(ini_get('upload_max_filesize')); // Set some information about the form Theme::Set('form_id', 'LayoutImportForm'); Theme::Set('form_action', 'index.php?p=layout&q=Import'); Theme::Set('form_meta', '<input type="hidden" id="txtFileName" name="txtFileName" readonly="true" /><input type="hidden" name="hidFileID" id="hidFileID" value="" /><input type="hidden" name="template" value="' . Kit::GetParam('template', _GET, _STRING, 'false') . '" />'); Theme::Set('form_upload_id', 'file_upload'); Theme::Set('form_upload_action', 'index.php?p=content&q=FileUpload'); Theme::Set('form_upload_meta', '<input type="hidden" id="PHPSESSID" value="' . $sessionId . '" /><input type="hidden" id="SecurityToken" value="' . $securityToken . '" /><input type="hidden" name="MAX_FILE_SIZE" value="' . $maxFileSizeBytes . '" />'); Theme::Set('prepend', Theme::RenderReturn('form_file_upload_single')); $formFields = array(); $formFields[] = FormManager::AddText('layout', __('Name'), NULL, __('The Name of the Layout - (1 - 50 characters). Leave blank to use the name from the import.'), 'n'); $formFields[] = FormManager::AddCheckbox('replaceExisting', __('Replace Existing Media?'), NULL, __('If the import finds existing media with the same name, should it be replaced in the Layout or should the Layout use that media.'), 'r'); if (Kit::GetParam('template', _GET, _STRING, 'false') != 'true') { $formFields[] = FormManager::AddCheckbox('importTags', __('Import Tags?'), NULL, __('Would you like to import any tags contained on the layout.'), 't'); } Theme::Set('form_fields', $formFields); $response->SetFormRequestResponse(NULL, __('Import Layout'), '350px', '200px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('DataSet', 'ImportCsv') . '")'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Import'), '$("#LayoutImportForm").submit()'); $response->Respond(); }
/** * Edit Form */ public function EditForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $helpManager = new HelpManager($db, $user); // Can we edit? if (Config::GetSetting('MODULE_CONFIG_LOCKED_CHECKB') == 'Checked') { trigger_error(__('Module Config Locked'), E_USER_ERROR); } $moduleId = Kit::GetParam('ModuleID', _GET, _INT); // Pull the currently known info from the DB $SQL = ''; $SQL .= 'SELECT ModuleID, '; $SQL .= ' Name, '; $SQL .= ' Enabled, '; $SQL .= ' Description, '; $SQL .= ' RegionSpecific, '; $SQL .= ' ValidExtensions, '; $SQL .= ' ImageUri, '; $SQL .= ' PreviewEnabled '; $SQL .= ' FROM `module` '; $SQL .= ' WHERE ModuleID = %d '; $SQL = sprintf($SQL, $moduleId); if (!($row = $db->GetSingleRow($SQL))) { trigger_error($db->error()); trigger_error(__('Error getting Module')); } Theme::Set('validextensions', Kit::ValidateParam($row['ValidExtensions'], _STRING)); Theme::Set('imageuri', Kit::ValidateParam($row['ImageUri'], _STRING)); Theme::Set('isregionspecific', Kit::ValidateParam($row['RegionSpecific'], _INT)); Theme::Set('enabled_checked', Kit::ValidateParam($row['Enabled'], _INT) ? 'checked' : ''); Theme::Set('preview_enabled_checked', Kit::ValidateParam($row['PreviewEnabled'], _INT) ? 'checked' : ''); // Set some information about the form Theme::Set('form_id', 'ModuleEditForm'); Theme::Set('form_action', 'index.php?p=module&q=Edit'); Theme::Set('form_meta', '<input type="hidden" name="ModuleID" value="' . $moduleId . '" />'); $form = Theme::RenderReturn('module_form_edit'); $response->SetFormRequestResponse($form, __('Edit Module'), '350px', '325px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . $helpManager->Link('Module', 'Edit') . '")'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Save'), '$("#ModuleEditForm").submit()'); $response->Respond(); }
public function tidyLibraryForm() { $response = new ResponseManager(); Theme::Set('form_id', 'TidyLibraryForm'); Theme::Set('form_action', 'index.php?p=content&q=tidyLibrary'); $formFields = array(); $formFields[] = FormManager::AddMessage(__('Tidying your Library will delete any media that is not currently in use.')); // Work out how many files there are $media = Media::entriesUnusedForUser($this->user->userid); $formFields[] = FormManager::AddMessage(sprintf(__('There is %s of data stored in %d files . Are you sure you want to proceed?', Kit::formatBytes(array_sum(array_map(function ($element) { return $element['fileSize']; }, $media))), count($media)))); Theme::Set('form_fields', $formFields); $response->SetFormRequestResponse(NULL, __('Tidy Library'), '350px', '275px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Content', 'TidyLibrary') . '")'); $response->AddButton(__('No'), 'XiboDialogClose()'); $response->AddButton(__('Yes'), '$("#TidyLibraryForm").submit()'); $response->Respond(); }
/** * Edit Form */ public function VerifyForm() { $user =& $this->user; $response = new ResponseManager(); $helpManager = new HelpManager(NULL, $user); // Set some information about the form Theme::Set('form_id', 'VerifyForm'); Theme::Set('form_action', 'index.php?p=module&q=Verify'); $formFields = array(); $formFields[] = FormManager::AddMessage(__('Verify all modules have been installed correctly by reinstalling any module related files')); Theme::Set('form_fields', $formFields); $response->SetFormRequestResponse(NULL, __('Verify'), '350px', '325px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . $helpManager->Link('Module', 'Edit') . '")'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Verify'), '$("#VerifyForm").submit()'); $response->Respond(); }
public function VersionInstructionsForm() { $response = new ResponseManager(); $displayGroupId = Kit::GetParam('displaygroupid', _GET, _INT); $displayId = Kit::GetParam('displayid', _GET, _INT); Theme::Set('installer_file_id', 0); // List of effected displays $rows = array(); if ($displayId != 0) { // Get some version information about this display. if (!($displays = $this->user->DisplayList(array('display'), array('displayid' => $displayId)))) { trigger_error(__('Unknown Display'), E_USER_ERROR); } } else { // Get a list of displays with their version information? if (!($displays = $this->user->DisplayList(array('display'), array('displaygroupid' => $displayGroupId)))) { trigger_error(__('No displays in this group'), E_USER_ERROR); } } foreach ($displays as $display) { $rows[] = array('display' => Theme::Prepare($display['display']), 'client_type' => Theme::Prepare($display['client_type']), 'client_version' => Theme::Prepare($display['client_version']), 'client_code' => Theme::Prepare($display['client_code'])); } // Store this for use in the theme Theme::Set('displays', $displays); // Present a list of possible files to choose from (generic file module) $mediaList = $this->user->MediaList('genericfile'); array_unshift($mediaList, array('mediaid' => 0, 'media' => '')); Theme::Set('media_field_list', $mediaList); // Set some information about the form Theme::Set('form_id', 'VersionInstructions'); Theme::Set('form_action', 'index.php?p=displaygroup&q=VersionInstructions'); Theme::Set('form_meta', '<input type="hidden" name="displaygroupid" value="' . $displayGroupId . '">'); $form = Theme::RenderReturn('display_form_version_instructions'); $response->SetFormRequestResponse($form, __('Set Instructions for Upgrading this client'), '300px', '250px'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Save'), '$("#VersionInstructions").submit()'); $response->Respond(); }
public function ImportCsvForm() { global $session; $db =& $this->db; $response = new ResponseManager(); $dataSetId = Kit::GetParam('datasetid', _GET, _INT); $dataSet = Kit::GetParam('dataset', _GET, _STRING); $auth = $this->user->DataSetAuth($dataSetId, true); if (!$auth->edit) { trigger_error(__('Access Denied'), E_USER_ERROR); } // Set the Session / Security information $sessionId = session_id(); $securityToken = CreateFormToken(); $session->setSecurityToken($securityToken); // Find the max file size $maxFileSizeBytes = convertBytes(ini_get('upload_max_filesize')); // Set some information about the form Theme::Set('form_id', 'DataSetImportCsvForm'); Theme::Set('form_action', 'index.php?p=dataset&q=ImportCsv'); Theme::Set('form_meta', '<input type="hidden" name="dataset" value="' . $dataSet . '" /><input type="hidden" name="datasetid" value="' . $dataSetId . '" /><input type="hidden" id="txtFileName" name="txtFileName" readonly="true" /><input type="hidden" name="hidFileID" id="hidFileID" value="" />'); Theme::Set('form_upload_id', 'file_upload'); Theme::Set('form_upload_action', 'index.php?p=content&q=FileUpload'); Theme::Set('form_upload_meta', '<input type="hidden" id="PHPSESSID" value="' . $sessionId . '" /><input type="hidden" id="SecurityToken" value="' . $securityToken . '" /><input type="hidden" name="MAX_FILE_SIZE" value="' . $maxFileSizeBytes . '" />'); // Enumerate over the columns in the DataSet and offer a column mapping for each one (from the file) $SQL = ""; $SQL .= "SELECT DataSetColumnID, Heading "; $SQL .= " FROM datasetcolumn "; $SQL .= sprintf(" WHERE DataSetID = %d ", $dataSetId); $SQL .= " AND DataSetColumnTypeID = 1 "; $SQL .= "ORDER BY ColumnOrder "; // Load results into an array $dataSetColumns = $db->GetArray($SQL); if (!is_array($dataSetColumns)) { trigger_error($db->error()); trigger_error(__('Error getting list of dataSetColumns'), E_USER_ERROR); } $rows = array(); $i = 0; foreach ($dataSetColumns as $row) { $i++; $row['heading'] = Kit::ValidateParam($row['Heading'], _STRING); $row['formfieldid'] = 'csvImport_' . Kit::ValidateParam($row['DataSetColumnID'], _INT); $row['auto_column_number'] = $i; $rows[] = $row; } Theme::Set('fields', $rows); $form = Theme::RenderReturn('dataset_form_csv_import'); $response->SetFormRequestResponse($form, __('CSV Import'), '350px', '200px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('DataSet', 'ImportCsv') . '")'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Import'), '$("#DataSetImportCsvForm").submit()'); $response->Respond(); }
/** * Form for wake on Lan */ public function WakeOnLanForm() { $db =& $this->db; $response = new ResponseManager(); $displayId = Kit::GetParam('DisplayId', _GET, _INT); // Get the MAC Address $macAddress = $db->GetSingleValue(sprintf("SELECT MacAddress FROM `display` WHERE DisplayID = %d", $displayId), 'MacAddress', _STRING); if (!$macAddress || $macAddress == '') { trigger_error(__('This display has no mac address recorded against it yet. Make sure the display is running.'), E_USER_ERROR); } // Set some information about the form Theme::Set('form_id', 'WakeOnLanForm'); Theme::Set('form_action', 'index.php?p=display&q=WakeOnLan'); Theme::Set('form_meta', '<input type="hidden" name="DisplayId" value="' . $displayId . '"><input type="hidden" name="MacAddress" value="' . $macAddress . '">'); $form = Theme::RenderReturn('display_form_wakeonlan'); $response->SetFormRequestResponse($form, __('Wake On Lan'), '300px', '250px'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Send'), '$("#WakeOnLanForm").submit()'); $response->Respond(); }
/** * Shows the TimeLine */ public function Timeline() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $response->html = ''; $layoutId = Kit::GetParam('layoutid', _GET, _INT); $regionId = Kit::GetParam('regionid', _REQUEST, _STRING); // Make sure we have permission to edit this region Kit::ClassLoader('region'); $region = new region($db); $ownerId = $region->GetOwnerId($layoutId, $regionId); $regionAuth = $this->user->RegionAssignmentAuth($ownerId, $layoutId, $regionId, true); if (!$regionAuth->edit) { trigger_error(__('You do not have permissions to edit this region'), E_USER_ERROR); } // Library location $libraryLocation = Config::GetSetting('LIBRARY_LOCATION'); // Present a canvas with 2 columns, left column for the media icons $buttons = array(); // Always output a Library assignment button $buttons[] = array('id' => 'media_button_library', 'url' => 'index.php?p=content&q=LibraryAssignForm&layoutid=' . $layoutId . '®ionid=' . $regionId, 'text' => __('Library')); // Get a list of the enabled modules and then create buttons for them if (!($enabledModules = new ModuleManager($db, $user))) { trigger_error($enabledModules->message, E_USER_ERROR); } // Loop through the buttons we have and output each one while ($modulesItem = $enabledModules->GetNextModule()) { $mod = Kit::ValidateParam($modulesItem['Module'], _STRING); $caption = Kit::ValidateParam($modulesItem['Name'], _STRING); $mod = strtolower($mod); $title = Kit::ValidateParam($modulesItem['Description'], _STRING); $img = Kit::ValidateParam($modulesItem['ImageUri'], _STRING); $buttons[] = array('id' => 'media_button_' . $mod, 'url' => 'index.php?p=module&q=Exec&mod=' . $mod . '&method=AddForm&layoutid=' . $layoutId . '®ionid=' . $regionId, 'text' => __($caption)); } Theme::Set('media_buttons', $buttons); $response->html .= '<div class="container-fluid">'; $response->html .= '<div class="row-fluid">'; $response->html .= Theme::RenderReturn('layout_designer_form_timeline'); // Load the XML for this layout and region, we need to get the media nodes. // These form the timeline and go in the right column // Generate an ID for the list (this is passed into the reorder function) $timeListMediaListId = uniqid('timelineMediaList_'); $response->html .= '<div class="span10">'; $response->html .= '<div id="timelineControl" class="timelineColumn" layoutid="' . $layoutId . '" regionid="' . $regionId . '">'; $response->html .= ' <div class="timelineMediaVerticalList">'; $response->html .= ' <ul id="' . $timeListMediaListId . '" class="timelineSortableListOfMedia">'; // How are we going to colour the bars, my media type or my permissions $timeBarColouring = Config::GetSetting('REGION_OPTIONS_COLOURING'); // Create a layout object $region = new Region($db); foreach ($region->GetMediaNodeList($layoutId, $regionId) as $mediaNode) { // Put this node vertically in the region timeline $mediaId = $mediaNode->getAttribute('id'); $lkId = $mediaNode->getAttribute('lkid'); $mediaType = $mediaNode->getAttribute('type'); $mediaDuration = $mediaNode->getAttribute('duration'); $ownerId = $mediaNode->getAttribute('userId'); // Permissions for this assignment $auth = $user->MediaAssignmentAuth($ownerId, $layoutId, $regionId, $mediaId, true); // Skip over media assignments that we do not have permission to see if (!$auth->view) { continue; } Debug::LogEntry('audit', sprintf('Permission Granted to View MediaID: %s', $mediaId), 'layout', 'TimeLine'); // Create a media module to handle all the complex stuff require_once "modules/{$mediaType}.module.php"; $tmpModule = new $mediaType($db, $user, $mediaId, $layoutId, $regionId, $lkId); $mediaName = $tmpModule->GetName(); $transitionIn = $tmpModule->GetTransition('in'); $transitionOut = $tmpModule->GetTransition('out'); // Colouring for the media block if ($timeBarColouring == 'Permissions') { $mediaBlockColouringClass = 'timelineMediaItemColouring_' . ($auth->edit ? 'enabled' : 'disabled'); } else { $mediaBlockColouringClass = 'timelineMediaItemColouring_' . $mediaType; } // Create the list item $response->html .= '<li class="timelineMediaListItem" mediaid="' . $mediaId . '" lkid="' . $lkId . '">'; // In transition $response->html .= ' <div class="timelineMediaInTransition">'; if ($transitionIn != 'None') { $response->html .= '<span>' . $transitionIn . '</span>'; } $response->html .= ' </div>'; // Media Bar $response->html .= ' <div class="timelineMediaItem">'; $response->html .= ' <ul class="timelineMediaItemLinks">'; // Create some links if ($auth->edit) { $response->html .= '<li><a class="XiboFormButton timelineMediaBarLink" href="index.php?p=module&mod=' . $mediaType . '&q=Exec&method=EditForm&layoutid=' . $layoutId . '®ionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId . '" title="' . __('Click to edit this media') . '">' . __('Edit') . '</a></li>'; } if ($auth->del) { $response->html .= '<li><a class="XiboFormButton timelineMediaBarLink" href="index.php?p=module&mod=' . $mediaType . '&q=Exec&method=DeleteForm&layoutid=' . $layoutId . '®ionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId . '" title="' . __('Click to delete this media') . '">' . __('Delete') . '</a></li>'; } if ($auth->modifyPermissions) { $response->html .= '<li><a class="XiboFormButton timelineMediaBarLink" href="index.php?p=module&mod=' . $mediaType . '&q=Exec&method=PermissionsForm&layoutid=' . $layoutId . '®ionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId . '" title="Click to change permissions for this media">' . __('Permissions') . '</a></li>'; } if (count($this->user->TransitionAuth('in')) > 0) { $response->html .= '<li><a class="XiboFormButton timelineMediaBarLink" href="index.php?p=module&mod=' . $mediaType . '&q=Exec&method=TransitionEditForm&type=in&layoutid=' . $layoutId . '®ionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId . '" title="' . __('Click to edit this transition') . '">' . __('In Transition') . '</a></li>'; } if (count($this->user->TransitionAuth('out')) > 0) { $response->html .= '<li><a class="XiboFormButton timelineMediaBarLink" href="index.php?p=module&mod=' . $mediaType . '&q=Exec&method=TransitionEditForm&type=out&layoutid=' . $layoutId . '®ionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId . '" title="' . __('Click to edit this transition') . '">' . __('Out Transition') . '</a></li>'; } $response->html .= ' </ul>'; // Put the media name in $response->html .= ' <div class="timelineMediaDetails ' . $mediaBlockColouringClass . '">'; $response->html .= ' <h3>' . ($mediaName == '' ? $tmpModule->displayType : $mediaName) . ' (' . $mediaDuration . ' seconds)</h3>'; $response->html .= ' </div>'; // Put the media hover preview in $mediaHoverPreview = $tmpModule->HoverPreview(); $response->html .= ' <div class="timelineMediaPreview">' . $mediaHoverPreview . '</div>'; // End the time line media item $response->html .= ' </div>'; // Out transition $response->html .= ' <div class="timelineMediaOutTransition">'; if ($transitionOut != 'None') { $response->html .= '<span>' . $transitionOut . '</span>'; } $response->html .= ' </div>'; // End of this media item $response->html .= '</li>'; } $response->html .= ' </ul>'; $response->html .= ' </div>'; // Output a div to contain the preview for this media item $response->html .= ' <div id="timelinePreview"></div>'; $response->html .= ' </div>'; $response->html .= '</div>'; $response->html .= '</div>'; $response->html .= '</div>'; // Finish constructing the response $response->callBack = 'LoadTimeLineCallback'; $response->dialogClass = 'modal-big'; $response->dialogTitle = __('Region Timeline'); $response->dialogSize = true; $response->dialogWidth = '1000px'; $response->dialogHeight = '550px'; $response->focusInFirstInput = false; // Add some buttons $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Layout', 'RegionOptions') . '")'); $response->AddButton(__('Close'), 'XiboDialogClose()'); $response->AddButton(__('Save Order'), 'XiboTimelineSaveOrder("' . $timeListMediaListId . '","' . $layoutId . '","' . $regionId . '")'); $response->Respond(); }
/** * Delete Help Link Form */ public function DeleteForm() { $db =& $this->db; $response = new ResponseManager(); $helpId = Kit::GetParam('HelpID', _REQUEST, _INT); // Set some information about the form Theme::Set('form_id', 'HelpDeleteForm'); Theme::Set('form_action', 'index.php?p=help&q=Delete'); Theme::Set('form_meta', '<input type="hidden" name="HelpID" value="' . $helpId . '" />'); Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to delete?')))); $response->SetFormRequestResponse(NULL, __('Delete Help Link'), '350px', '175px'); $response->AddButton(__('No'), 'XiboDialogClose()'); $response->AddButton(__('Yes'), '$("#HelpDeleteForm").submit()'); $response->Respond(); }
public function OutputCsvForm() { $response = new ResponseManager(); Theme::Set('form_id', 'OutputCsvForm'); Theme::Set('form_action', 'index.php?p=stats&q=OutputCSV'); $formFields = array(); $formFields[] = FormManager::AddText('fromdt', __('From Date'), DateManager::getLocalDate(time() - 86400 * 35, 'Y-m-d'), NULL, 'f'); $formFields[] = FormManager::AddText('todt', __('To Date'), DateManager::getLocalDate(null, 'Y-m-d'), NULL, 't'); // List of Displays this user has permission for $displays = $this->user->DisplayGroupList(1); array_unshift($displays, array('displayid' => 0, 'displaygroup' => 'All')); $formFields[] = FormManager::AddCombo('displayid', __('Display'), NULL, $displays, 'displayid', 'displaygroup', NULL, 'd'); Theme::Set('header_text', __('Bandwidth')); Theme::Set('form_fields', $formFields); Theme::Set('form_class', 'XiboManualSubmit'); $response->SetFormRequestResponse(NULL, __('Export Statistics'), '550px', '275px'); $response->AddButton(__('Export'), '$("#OutputCsvForm").submit()'); $response->AddButton(__('Close'), 'XiboDialogClose()'); $response->Respond(); }
public function TruncateForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); if ($this->user->usertypeid != 1) { trigger_error(__('Only Administrator Users can truncate the log'), E_USER_ERROR); } // Set some information about the form Theme::Set('form_id', 'TruncateForm'); Theme::Set('form_action', 'index.php?p=log&q=Truncate'); Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to truncate?')))); $response->SetFormRequestResponse(NULL, __('Truncate Log'), '430px', '200px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Log', 'Truncate') . '")'); $response->AddButton(__('No'), 'XiboDialogClose()'); $response->AddButton(__('Yes'), '$("#TruncateForm").submit()'); $response->Respond(); }
/** * Delete Help Link Form */ public function DeleteForm() { $db =& $this->db; $response = new ResponseManager(); $helpId = Kit::GetParam('HelpID', _REQUEST, _INT); // Set some information about the form Theme::Set('form_id', 'HelpDeleteForm'); Theme::Set('form_action', 'index.php?p=help&q=Delete'); Theme::Set('form_meta', '<input type="hidden" name="HelpID" value="' . $helpId . '" />'); $form = Theme::RenderReturn('help_form_delete'); $response->SetFormRequestResponse($form, __('Delete Help Link'), '350px', '175px'); $response->AddButton(__('No'), 'XiboDialogClose()'); $response->AddButton(__('Yes'), '$("#HelpDeleteForm").submit()'); $response->Respond(); }
public function TidyLibraryForm() { $response = new ResponseManager(); Theme::Set('form_id', 'TidyLibraryForm'); Theme::Set('form_action', 'index.php?p=admin&q=TidyLibrary'); $formFields = array(); $formFields[] = FormManager::AddMessage(__('Tidying the Library will delete any temporary files. Are you sure you want to proceed?')); // Check box to also delete un-used media that has been revised. $formFields[] = FormManager::AddCheckbox('tidyOldRevisions', __('Remove old revisions'), 0, __('Cleaning up old revisions of media will result in any unused media revisions being permanently deleted.'), ''); // Check box to tidy up un-used files $formFields[] = FormManager::AddCheckbox('cleanUnusedFiles', __('Remove all media not currently in use?'), 0, __('Selecting this option will remove any media that is not currently being used in Layouts or linked to Displays. This process cannot be reversed.'), ''); Theme::Set('form_fields', $formFields); $response->SetFormRequestResponse(NULL, __('Tidy Library'), '350px', '275px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Settings', 'TidyLibrary') . '")'); $response->AddButton(__('No'), 'XiboDialogClose()'); $response->AddButton(__('Yes'), '$("#TidyLibraryForm").submit()'); $response->Respond(); }
/** * Resolution Delete Form */ function DeleteForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $resolutionid = Kit::GetParam('resolutionid', _GET, _INT); // Set some information about the form Theme::Set('form_id', 'DeleteForm'); Theme::Set('form_action', 'index.php?p=resolution&q=Delete'); Theme::Set('form_meta', '<input type="hidden" name="resolutionid" value="' . $resolutionid . '" />'); Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to delete?')))); $response->SetFormRequestResponse(Theme::RenderReturn('form_render'), __('Delete Resolution'), '250px', '150px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Campaign', 'Delete') . '")'); $response->AddButton(__('No'), 'XiboDialogClose()'); $response->AddButton(__('Yes'), '$("#DeleteForm").submit()'); $response->Respond(); }
/** * Copy layout form */ public function CopyForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $layoutid = Kit::GetParam('layoutid', _REQUEST, _INT); $oldLayout = Kit::GetParam('oldlayout', _REQUEST, _STRING); $copyMediaChecked = Config::GetSetting('LAYOUT_COPY_MEDIA_CHECKB') == 'Checked' ? 'checked' : ''; Theme::Set('form_id', 'LayoutCopyForm'); Theme::Set('form_action', 'index.php?p=layout&q=Copy'); Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $layoutid . '">'); Theme::Set('copy_media_checked', $copyMediaChecked); Theme::Set('new_layout_default', $oldLayout . ' 2'); $form = Theme::RenderReturn('layout_form_copy'); $response->SetFormRequestResponse($form, __('Copy a Layout.'), '350px', '275px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Layout', 'Copy') . '")'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Copy'), '$("#LayoutCopyForm").submit()'); $response->Respond(); }
/** * Shows the form to delete a template */ public function DeleteTemplateForm() { $response = new ResponseManager(); $templateId = Kit::GetParam('layoutid', _GET, _INT); $auth = $this->user->TemplateAuth($templateId, true); if (!$auth->del) { trigger_error(__('You do not have permissions to delete this template'), E_USER_ERROR); } Theme::Set('form_id', 'DeleteForm'); Theme::Set('form_action', 'index.php?p=template&q=DeleteTemplate'); Theme::Set('form_meta', '<input type="hidden" name="templateId" value="' . $templateId . '">'); Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to delete this template?')))); $form = Theme::RenderReturn('form_render'); $response->SetFormRequestResponse($form, __('Delete Template'), '300px', '200px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Template', 'Delete') . '")'); $response->AddButton(__('No'), 'XiboDialogClose()'); $response->AddButton(__('Yes'), '$("#DeleteForm").submit()'); $response->Respond(); }
/** * Displays the Library Assign form * @return */ function LayoutAssignForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); // Input vars $campaignId = Kit::GetParam('CampaignID', _GET, _INT); $id = uniqid(); Theme::Set('id', $id); Theme::Set('form_meta', '<input type="hidden" name="p" value="campaign"><input type="hidden" name="q" value="LayoutAssignView">'); Theme::Set('pager', ResponseManager::Pager($id)); // Get the currently assigned layouts and put them in the "well" // // Layouts in group $SQL = "SELECT layout.Layoutid, "; $SQL .= " layout.layout, "; $SQL .= " CONCAT('LayoutID_', layout.LayoutID) AS list_id "; $SQL .= "FROM layout "; $SQL .= " INNER JOIN lkcampaignlayout "; $SQL .= " ON lkcampaignlayout.LayoutID = layout.LayoutID "; $SQL .= sprintf("WHERE lkcampaignlayout.CampaignID = %d", $campaignId); $SQL .= " ORDER BY lkcampaignlayout.DisplayOrder "; $layoutsAssigned = $db->GetArray($SQL); if (!is_array($layoutsAssigned)) { trigger_error($db->error()); trigger_error(__('Error getting Layouts'), E_USER_ERROR); } Debug::LogEntry('audit', count($layoutsAssigned) . ' layouts assigned already'); // Set the layouts assigned Theme::Set('layouts_assigned', $layoutsAssigned); // Call to render the template $output = Theme::RenderReturn('campaign_form_layout_assign'); // Construct the Response $response->html = $output; $response->success = true; $response->dialogSize = true; $response->dialogWidth = '780px'; $response->dialogHeight = '580px'; $response->dialogTitle = __('Layouts on Campaign'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Campaign', 'Layouts') . '")'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Save'), 'LayoutsSubmit("' . $campaignId . '")'); $response->Respond(); }
/** * Permissions form */ public function PermissionsForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $helpManager = new HelpManager($db, $user); $templateId = Kit::GetParam('templateid', _GET, _INT); if ($templateId == 0) { trigger_error(__('No template selected'), E_USER_ERROR); } // Is this user allowed to delete this template? $auth = $this->user->TemplateAuth($templateId, true); // Set some information about the form Theme::Set('form_id', 'TemplatePermissionsForm'); Theme::Set('form_action', 'index.php?p=template&q=Permissions'); Theme::Set('form_meta', '<input type="hidden" name="templateid" value="' . $templateId . '" />'); // List of all Groups with a view/edit/delete checkbox $SQL = ''; $SQL .= 'SELECT `group`.GroupID, `group`.`Group`, View, Edit, Del, `group`.IsUserSpecific '; $SQL .= ' FROM `group` '; $SQL .= ' LEFT OUTER JOIN lktemplategroup '; $SQL .= ' ON lktemplategroup.GroupID = group.GroupID '; $SQL .= ' AND lktemplategroup.TemplateID = %d '; $SQL .= ' WHERE `group`.GroupID <> %d '; $SQL .= 'ORDER BY `group`.IsEveryone DESC, `group`.IsUserSpecific, `group`.`Group` '; $SQL = sprintf($SQL, $templateId, $user->getGroupFromId($user->userid, true)); if (!($results = $db->query($SQL))) { trigger_error($db->error()); trigger_error(__('Unable to get permissions for this template'), E_USER_ERROR); } $checkboxes = array(); while ($row = $db->get_assoc_row($results)) { $groupId = $row['GroupID']; $rowClass = $row['IsUserSpecific'] == 0 ? 'strong_text' : ''; $checkbox = array('id' => $groupId, 'name' => Kit::ValidateParam($row['Group'], _STRING), 'class' => $rowClass, 'value_view' => $groupId . '_view', 'value_view_checked' => $row['View'] == 1 ? 'checked' : '', 'value_edit' => $groupId . '_edit', 'value_edit_checked' => $row['Edit'] == 1 ? 'checked' : '', 'value_del' => $groupId . '_del', 'value_del_checked' => $row['Del'] == 1 ? 'checked' : ''); $checkboxes[] = $checkbox; } Theme::Set('form_rows', $checkboxes); $form = Theme::RenderReturn('campaign_form_permissions'); $response->SetFormRequestResponse($form, __('Permissions'), '350px', '500px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . $helpManager->Link('Template', 'Permissions') . '")'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Save'), '$("#TemplatePermissionsForm").submit()'); $response->Respond(); }
/** * Shows the DeleteEvent form * @return */ function DeleteDayForm() { $response = new ResponseManager(); $date = Kit::GetParam('date', _GET, _INT, 0); $dateString = date('Y-m-d', $date); if ($date == 0) { trigger_error(__('Day not selected'), E_USER_ERROR); } $strQuestion = __('Are you sure you want to delete all events that intersect this day from <b>all</b> displays?'); $strAdvice = __('This action cannot be undone.'); $token = Kit::Token(); $form = <<<END <form id="DeleteDayForm" class="XiboForm" action="index.php?p=schedule&q=DeleteDay"> {$token} <input type="hidden" name="date" value="{$date}"> <table> <tr> <td>{$strQuestion}</td> </tr> <tr> <td>{$strAdvice}</td> </tr> </table> </form> END; $response->SetFormRequestResponse($form, sprintf(__('Delete %s'), $dateString), '480px', '240px'); $response->AddButton(__('Help'), "XiboHelpRender('index.php?p=help&q=Display&Topic=Schedule&Category=Delete')"); $response->AddButton(__('No'), 'XiboFormRender("index.php?p=schedule&q=DayViewFilter&date=' . $date . '")'); $response->AddButton(__('Yes'), '$("#DeleteDayForm").submit()'); $response->Respond(); }
/** * Shows information about Xibo * @return */ function About() { $response = new ResponseManager(); Theme::Set('version', VERSION); // Render the Theme and output $output = Theme::RenderReturn('about_text'); $response->SetFormRequestResponse($output, __('About'), '500', '500'); $response->AddButton(__('Close'), 'XiboDialogClose()'); $response->Respond(); }
public function ScheduleNowForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $date = time(); // We might have a layout id, or a display id $campaignId = Kit::GetParam('CampaignID', _GET, _INT, 0); $displayGroupIds = Kit::GetParam('displayGroupId', _GET, _ARRAY); Theme::Set('form_id', 'ScheduleNowForm'); Theme::Set('form_action', 'index.php?p=schedule&q=ScheduleNow'); $formFields = array(); // Generate a list of layouts. $layouts = $user->CampaignList(NULL, false, false); $optionGroups = array(array('id' => 'campaign', 'label' => __('Campaigns')), array('id' => 'layout', 'label' => __('Layouts'))); $layoutOptions = array(); $campaignOptions = array(); foreach ($layouts as $layout) { if ($layout['islayoutspecific'] == 1) { $layoutOptions[] = array('id' => $layout['campaignid'], 'value' => $layout['campaign']); } else { $campaignOptions[] = array('id' => $layout['campaignid'], 'value' => $layout['campaign']); } } $formFields[] = FormManager::AddCombo('CampaignID', __('Layout'), $campaignId, array('campaign' => $campaignOptions, 'layout' => $layoutOptions), 'id', 'value', __('Please select a Layout or Campaign for this Event to show'), 'l', '', true, '', '', '', $optionGroups); $formFields[] = FormManager::AddText('hours', __('Hours'), NULL, __('Hours this event should be scheduled for'), 'h', ''); $formFields[] = FormManager::AddText('minutes', __('Minutes'), NULL, __('Minutes this event should be scheduled for'), 'h', ''); $formFields[] = FormManager::AddText('seconds', __('Seconds'), NULL, __('Seconds this event should be scheduled for'), 'h', ''); // List of Display Groups $optionGroups = array(array('id' => 'group', 'label' => __('Groups')), array('id' => 'display', 'label' => __('Displays'))); $groups = array(); $displays = array(); $scheduleWithView = Config::GetSetting('SCHEDULE_WITH_VIEW_PERMISSION') == 'Yes'; foreach ($this->user->DisplayGroupList(-1) as $display) { // Can schedule with view, but no view permissions if ($scheduleWithView && $display['view'] != 1) { continue; } // Can't schedule with view, but no edit permissions if (!$scheduleWithView && $display['edit'] != 1) { continue; } $display['checked_text'] = in_array($display['displaygroupid'], $displayGroupIds) ? ' selected' : ''; if ($display['isdisplayspecific'] == 1) { $displays[] = $display; } else { $groups[] = $display; } } $formFields[] = FormManager::AddMultiCombo('DisplayGroupIDs[]', __('Display'), $displayGroupIds, array('group' => $groups, 'display' => $displays), 'displaygroupid', 'displaygroup', __('Please select one or more displays / groups for this event to be shown on.'), 'd', '', true, '', '', '', $optionGroups, array(array('name' => 'data-live-search', 'value' => "true"), array('name' => 'data-selected-text-format', 'value' => "count > 4"))); $formFields[] = FormManager::AddNumber('DisplayOrder', __('Display Order'), 0, __('Should this event have an order?'), 'o', ''); $formFields[] = FormManager::AddCheckbox('is_priority', __('Priority?'), NULL, __('Sets whether or not this event has priority. If set the event will be show in preference to other events.'), 'p'); Theme::Set('form_fields', $formFields); $response->SetFormRequestResponse(NULL, __('Schedule Now'), '700px', '400px'); $response->callBack = 'setupScheduleNowForm'; $response->AddButton(__('Help'), "XiboHelpRender('index.php?p=help&q=Display&Topic=Schedule&Category=ScheduleNow')"); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Save'), '$("#ScheduleNowForm").submit()'); $response->Respond(); }
function ConfirmLogout() { $db =& $this->db; $response = new ResponseManager(); $userid = Kit::GetParam('userid', _GET, _INT); // Set some information about the form Theme::Set('form_id', 'SessionsLogoutForm'); Theme::Set('form_action', 'index.php?p=sessions&q=LogoutUser'); Theme::Set('form_meta', '<input type="hidden" name="userid" value="' . $userid . '" />'); Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to logout this user?')))); $response->SetFormRequestResponse(NULL, __('Logout User'), '430px', '200px'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Sessions', 'Logout') . '")'); $response->AddButton(__('No'), 'XiboDialogClose()'); $response->AddButton(__('Yes'), '$("#SessionsLogoutForm").submit()'); $response->Respond(); }
/** * Displays the Library Assign form * @return */ function LibraryAssignForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $id = uniqid(); Theme::Set('id', $id); Theme::Set('form_meta', '<input type="hidden" name="p" value="content"><input type="hidden" name="q" value="LibraryAssignView">'); Theme::Set('pager', ResponseManager::Pager($id)); // Module types filter $modules = $this->user->ModuleAuth(0, '', 1); $types = array(); foreach ($modules as $module) { $type['moduleid'] = $module['Module']; $type['module'] = $module['Name']; $types[] = $type; } array_unshift($types, array('moduleid' => '', 'module' => 'All')); Theme::Set('module_field_list', $types); // Call to render the template $output = Theme::RenderReturn('library_form_assign'); // Input vars $layoutId = Kit::GetParam('layoutid', _REQUEST, _INT); $regionId = Kit::GetParam('regionid', _REQUEST, _STRING); // Construct the Response $response->html = $output; $response->success = true; $response->dialogSize = true; $response->dialogClass = 'modal-big'; $response->dialogWidth = '780px'; $response->dialogHeight = '580px'; $response->dialogTitle = __('Assign an item from the Library'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Library', 'Assign') . '")'); $response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=timeline&layoutid=' . $layoutId . '®ionid=' . $regionId . '&q=RegionOptions")'); $response->AddButton(__('Assign'), 'LibraryAssignSubmit("' . $layoutId . '","' . $regionId . '")'); $response->Respond(); }
public function RequestScreenShotForm() { $db =& $this->db; $response = new ResponseManager(); $displayId = Kit::GetParam('displayId', _GET, _INT); // Set some information about the form Theme::Set('form_id', 'RequestScreenShotForm'); Theme::Set('form_action', 'index.php?p=display&q=RequestScreenShot'); Theme::Set('form_meta', '<input type="hidden" name="displayId" value="' . $displayId . '">'); Theme::Set('form_fields', array(FormManager::AddMessage(__('Are you sure you want to request a screen shot? The next time the client connects to the CMS the screen shot will be sent.')))); $response->SetFormRequestResponse(NULL, __('Request Screen Shot'), '300px', '250px'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Request'), '$("#RequestScreenShotForm").submit()'); $response->Respond(); }
/** * Shows the Authorised applications this user has */ public function UserTokens() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $store = OAuthStore::instance(); try { $list = $store->listConsumerTokens(Kit::GetParam('userID', _GET, _INT)); } catch (OAuthException $e) { trigger_error($e->getMessage()); trigger_error(__('Error listing Log.'), E_USER_ERROR); } $rows = array(); foreach ($list as $app) { $app['application_title'] = Kit::ValidateParam($app['application_title'], _STRING); $app['enabled'] = Kit::ValidateParam($app['enabled'], _STRING); $app['status'] = Kit::ValidateParam($app['status'], _STRING); $rows[] = $app; } Theme::Set('table_rows', $rows); $output = Theme::RenderReturn('application_form_user_applications'); $response->SetFormRequestResponse($output, __('Authorized applications for user'), '650', '450'); $response->AddButton(__('Help'), "XiboHelpRender('" . HelpManager::Link('User', 'Applications') . "')"); $response->AddButton(__('Close'), 'XiboDialogClose()'); $response->Respond(); }
/** * Displays the Library Assign form * @return */ function LayoutAssignForm() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); // Input vars $campaignId = Kit::GetParam('CampaignID', _GET, _INT); $id = uniqid(); Theme::Set('id', $id); Theme::Set('form_meta', '<input type="hidden" name="p" value="campaign"><input type="hidden" name="q" value="LayoutAssignView">'); Theme::Set('pager', ResponseManager::Pager($id, 'grid_pager')); // Get the currently assigned layouts and put them in the "well" $layoutsAssigned = Layout::Entries(array('lkcl.DisplayOrder'), array('campaignId' => $campaignId)); if (!is_array($layoutsAssigned)) { trigger_error($db->error()); trigger_error(__('Error getting Layouts'), E_USER_ERROR); } Debug::LogEntry('audit', count($layoutsAssigned) . ' layouts assigned already'); $formFields = array(); $formFields[] = FormManager::AddText('filter_name', __('Name'), NULL, NULL, 'l'); $formFields[] = FormManager::AddText('filter_tags', __('Tags'), NULL, NULL, 't'); Theme::Set('form_fields', $formFields); // Set the layouts assigned Theme::Set('layouts_assigned', $layoutsAssigned); Theme::Set('append', Theme::RenderReturn('campaign_form_layout_assign')); // Call to render the template Theme::Set('header_text', __('Choose Layouts')); $output = Theme::RenderReturn('grid_render'); // Construct the Response $response->html = $output; $response->success = true; $response->dialogSize = true; $response->dialogWidth = '780px'; $response->dialogHeight = '580px'; $response->dialogTitle = __('Layouts on Campaign'); $response->AddButton(__('Help'), 'XiboHelpRender("' . HelpManager::Link('Campaign', 'Layouts') . '")'); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Save'), 'LayoutsSubmit("' . $campaignId . '")'); $response->Respond(); }
/** * Shows the Members of a Group */ public function MembersForm() { $db =& $this->db; $response = new ResponseManager(); $groupID = Kit::GetParam('groupid', _REQUEST, _INT); // There needs to be two lists here. // Set some information about the form Theme::Set('users_assigned_id', 'usersIn'); Theme::Set('users_available_id', 'usersOut'); Theme::Set('users_assigned_url', 'index.php?p=group&q=SetMembers&GroupID=' . $groupID); // Users in group $SQL = ""; $SQL .= "SELECT user.UserID, "; $SQL .= " user.UserName, "; $SQL .= " CONCAT('UserID_', user.userID) AS list_id "; $SQL .= "FROM `user` "; $SQL .= " INNER JOIN lkusergroup "; $SQL .= " ON lkusergroup.UserID = user.UserID "; $SQL .= sprintf("WHERE lkusergroup.GroupID = %d", $groupID); $usersAssigned = $db->GetArray($SQL); if (!is_array($usersAssigned)) { trigger_error($db->error()); trigger_error(__('Error getting users'), E_USER_ERROR); } Theme::Set('users_assigned', $usersAssigned); // Users not in group $SQL = ""; $SQL .= "SELECT user.UserID, "; $SQL .= " user.UserName, "; $SQL .= " CONCAT('UserID_', user.userID) AS list_id "; $SQL .= "FROM `user` "; $SQL .= " WHERE user.UserID NOT IN ( "; $SQL .= " SELECT user.UserID "; $SQL .= " FROM `user` "; $SQL .= " INNER JOIN lkusergroup "; $SQL .= " ON lkusergroup.UserID = user.UserID "; $SQL .= sprintf("WHERE lkusergroup.GroupID = %d", $groupID); $SQL .= " )"; $usersAvailable = $db->GetArray($SQL); if (!is_array($usersAvailable)) { trigger_error($db->error()); trigger_error(__('Error getting users'), E_USER_ERROR); } Theme::Set('users_available', $usersAvailable); $form = Theme::RenderReturn('usergroup_form_user_assign'); $response->SetFormRequestResponse($form, __('Manage Membership'), '400', '375', 'ManageMembersCallBack'); $response->AddButton(__('Help'), "XiboHelpRender('" . HelpManager::Link('UserGroup', 'Members') . "')"); $response->AddButton(__('Cancel'), 'XiboDialogClose()'); $response->AddButton(__('Save'), 'MembersSubmit()'); $response->Respond(); }