* $Id: EditHelpGroupControl.php 1246 2007-09-14 23:47:42Z ipso $
 * $Date: 2007-09-14 16:47:42 -0700 (Fri, 14 Sep 2007) $
 */
require_once '../../includes/global.inc.php';
require_once Environment::getBasePath() . 'includes/Interface.inc.php';
if (!$permission->Check('help', 'enabled') or !($permission->Check('help', 'edit') or $permission->Check('help', 'edit_own'))) {
    $permission->Redirect(FALSE);
    //Redirect
}
$smarty->assign('title', TTi18n::gettext($title = 'Edit Help Group'));
// See index.php
/*
 * Get FORM variables
 */
extract(FormVariables::GetVariables(array('action', 'id', 'help_data', 'script', 'name')));
$hgcf = new HelpGroupControlFactory();
switch ($action) {
    case 'submit':
        Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
        $hgcf->setId($help_data['id']);
        $hgcf->setScriptName($help_data['script_name']);
        $hgcf->setName($help_data['name']);
        if ($hgcf->isValid()) {
            $hgcf->Save();
            Redirect::Page(URLBuilder::getURL(NULL, 'HelpGroupControlList.php'));
            break;
        }
    default:
        $hgclf = new HelpGroupControlListFactory();
        if (isset($script) and !isset($id)) {
            Debug::Text('Script and Name were passed, attempt lookup!', __FILE__, __LINE__, __METHOD__, 10);
    function getByScriptNameAndStatus($script_name, $status, $where = NULL, $order = NULL)
    {
        if ($script_name == '') {
            return FALSE;
        }
        if ($status == '') {
            return FALSE;
        }
        $status_key = Option::getByValue($status, $this->getOptions('status'));
        if ($status_key !== FALSE) {
            $status = $status_key;
        }
        $hgcf = new HelpGroupControlFactory();
        $hg = new HelpGroupFactory();
        $ph = array('script_name' => $script_name, 'status_id' => $status);
        $query = '
					select 	a.*, b.name as group_name
					from	' . $this->getTable() . ' as a,
							' . $hgcf->getTable() . ' as b,
							' . $hg->getTable() . ' as c
					where	b.id = c.help_group_control_id
							AND c.help_id = a.id
							AND b.script_name = ?
							AND a.status_id = ?
							AND a.deleted=0
							AND b.deleted=0
					ORDER BY a.type_id desc, c.order_value asc
						';
        $query .= $this->getWhereSQL($where);
        $query .= $this->getSortSQL($order);
        $this->ExecuteSQL($query, $ph);
        return $this;
    }
Example #3
0
 * $Id: EditHelpGroup.php 1246 2007-09-14 23:47:42Z ipso $
 * $Date: 2007-09-14 16:47:42 -0700 (Fri, 14 Sep 2007) $
 */
require_once '../../includes/global.inc.php';
require_once Environment::getBasePath() . 'includes/Interface.inc.php';
if (!$permission->Check('help', 'enabled') or !($permission->Check('help', 'edit') or $permission->Check('help', 'edit_own'))) {
    $permission->Redirect(FALSE);
    //Redirect
}
$smarty->assign('title', TTi18n::gettext($title = 'Edit Help Group Entries'));
// See index.php
/*
 * Get FORM variables
 */
extract(FormVariables::GetVariables(array('action', 'id', 'help_data', 'script', 'name')));
$hgcf = new HelpGroupControlFactory();
switch ($action) {
    case 'submit':
        Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
        $hgcf->setId($help_data['id']);
        $hgcf->setHelp($help_data['selected_help_ids']);
        if ($hgcf->isValid()) {
            //$hgcf->Save();
            Redirect::Page(URLBuilder::getURL(NULL, 'HelpGroupControlList.php'));
            break;
        }
    default:
        $hgclf = new HelpGroupControlListFactory();
        if (isset($script) and !isset($id)) {
            Debug::Text('Script and Name were passed, attempt lookup!', __FILE__, __LINE__, __METHOD__, 10);
            $hgclf->getByScriptAndName($script, $name);