/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */
function smarty_function_getQuickHelpData($params, &$smarty)
{
    global $permission;
    if ($permission->Check('help', 'enabled') and ($permission->Check('help', 'view') or $permission->Check('help', 'view_own'))) {
        /*
        $split_script = explode('/', $_SERVER['SCRIPT_NAME']);
        $script = $split_script[count($split_script)-1];
        */
        $script = basename($_SERVER['SCRIPT_NAME']);
        $hlf = new HelpListFactory();
        $hlf->getByScriptNameAndType($script, 'Form');
        foreach ($hlf as $help_obj) {
            $tmp_entries[$help_obj->getColumn('group_name')][] = array('id' => $help_obj->GetId(), 'group_name' => $help_obj->getColumn('group_name'), 'heading' => $help_obj->getHeading(), 'body' => $help_obj->getBody());
        }
        //var_dump($tmp_entries);
        if (isset($tmp_entries)) {
            foreach ($tmp_entries as $group_name => $value) {
                $help_entries[] = array('group_name' => $group_name, 'entries' => $value);
            }
        }
        //var_dump($help_entries);
        $smarty->assign_by_ref('SCRIPT_BASE_NAME', $script);
        $smarty->assign_by_ref('quick_help_entries', $help_entries);
        $smarty->display('help/QuickHelpList.tpl');
    }
}
 function setHelp($id)
 {
     $id = trim($id);
     $hlf = new HelpListFactory();
     if ($this->Validator->isResultSetWithRows('help', $hlf->getByID($id), TTi18n::gettext('Help Entry is invalid'))) {
         $this->data['help_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
$title = 'Edit Help';
$smarty->assign('title', $title);
*/
/*
 * Get FORM variables
 */
extract(FormVariables::GetVariables(array('action', 'script', 'group', 'title')));
$hf = new HelpFactory();
switch ($action) {
    case 'submit':
        Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
    default:
        //Trim path off script name
        $split_script = explode('/', $script);
        $script = $split_script[count($split_script) - 1];
        $hlf = new HelpListFactory();
        //$hlf->getByScriptNameAndGroupName($script, NULL);
        $hlf->getByScriptNameAndStatus($script, 'ACTIVE');
        //$hlf->getById($id);
        $i = 0;
        foreach ($hlf as $help_obj) {
            //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10);
            if ($i > 0 and $prev_type != $help_obj->getType()) {
                $type_change = TRUE;
            } else {
                $type_change = FALSE;
            }
            $help_entries[] = array('id' => $help_obj->GetId(), 'type_id' => $help_obj->getType(), 'type' => Option::getByKey($help_obj->getType(), $help_obj->getOptions('type')), 'type_change' => $type_change, 'status_id' => $help_obj->getStatus(), 'status' => Option::getByKey($help_obj->getStatus(), $help_obj->getOptions('status')), 'heading' => $help_obj->getHeading(), 'body' => $help_obj->getBody(), 'keywords' => $help_obj->getKeywords(), 'private' => $help_obj->getPrivate(), 'created_date' => $help_obj->getCreatedDate(), 'created_by' => $help_obj->getCreatedBy(), 'updated_date' => $help_obj->getUpdatedDate(), 'updated_by' => $help_obj->getUpdatedBy(), 'deleted_date' => $help_obj->getDeletedDate(), 'deleted_by' => $help_obj->getDeletedBy(), 'deleted' => $help_obj->getDeleted());
            $prev_type = $help_obj->getType();
            $i++;
        }
 function getAllArray()
 {
     $hlf = new HelpListFactory();
     $hlf->getAll();
     $help_list[0] = '--';
     foreach ($hlf as $help) {
         $help_list[$help->getID()] = '(' . $help->getID() . ') [' . Option::getByKey($help->getType(), $help->getOptions('type')) . '] ' . $help->getHeading();
     }
     return $help_list;
 }
Example #5
0
            $hgclf->getByScriptAndName($script, $name);
            if ($hgclf->getRecordCount() > 0) {
                $id = $hgclf->getCurrent()->getID();
                Debug::Text('Found already existing ID: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
            } else {
                //$help_data = array( 'script_name' => $script, 'name' => $name);
            }
        }
        if (isset($id)) {
            BreadCrumb::setCrumb($title);
            $hgclf->getById($id);
            foreach ($hgclf as $help_obj) {
                //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10);
                $help_data = array('id' => $help_obj->getId(), 'script_name' => $help_obj->getScriptName(), 'name' => $help_obj->getName(), 'help_ids' => $help_obj->getHelp(), 'created_date' => $help_obj->getCreatedDate(), 'created_by' => $help_obj->getCreatedBy(), 'updated_date' => $help_obj->getUpdatedDate(), 'updated_by' => $help_obj->getUpdatedBy(), 'deleted_date' => $help_obj->getDeletedDate(), 'deleted_by' => $help_obj->getDeletedBy(), 'deleted' => $help_obj->getDeleted());
            }
        }
        //Get all help items
        $hlf = new HelpListFactory();
        $help_options = $hlf->getAllArray();
        //Select box options;
        $help_data['help_options'] = $help_options;
        if (isset($help_data['help_ids']) and is_array($help_data['help_ids'])) {
            foreach ($help_data['help_ids'] as $selected_help_id) {
                $help_data['selected_help_options'][$selected_help_id] = $help_options[$selected_help_id];
            }
        }
        $smarty->assign_by_ref('help_data', $help_data);
        break;
}
$smarty->assign_by_ref('hgcf', $hgcf);
$smarty->display('help/EditHelpGroup.tpl');
Example #6
0
        if (isset($help_data['private'])) {
            $hf->setPrivate(TRUE);
        } else {
            $hf->setPrivate(FALSE);
        }
        $hf->setHeading($help_data['heading']);
        $hf->setBody($help_data['body']);
        $hf->setKeywords($help_data['keywords']);
        if ($hf->isValid()) {
            $hf->Save();
            Redirect::Page(URLBuilder::getURL(NULL, 'HelpList.php'));
            break;
        }
    default:
        if (isset($id)) {
            BreadCrumb::setCrumb($title);
            $hlf = new HelpListFactory();
            $hlf->getById($id);
            foreach ($hlf as $help_obj) {
                //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10);
                $help_data = array('id' => $help_obj->GetId(), 'type' => $help_obj->getType(), 'status' => $help_obj->getStatus(), 'heading' => $help_obj->getHeading(), 'body' => $help_obj->getBody(), 'keywords' => $help_obj->getKeywords(), 'private' => $help_obj->getPrivate(), 'created_date' => $help_obj->getCreatedDate(), 'created_by' => $help_obj->getCreatedBy(), 'updated_date' => $help_obj->getUpdatedDate(), 'updated_by' => $help_obj->getUpdatedBy(), 'deleted_date' => $help_obj->getDeletedDate(), 'deleted_by' => $help_obj->getDeletedBy(), 'deleted' => $help_obj->getDeleted());
            }
        }
        //Select box options;
        $help_data['status_options'] = $hf->getOptions('status');
        $help_data['type_options'] = $hf->getOptions('type');
        $smarty->assign_by_ref('help_data', $help_data);
        break;
}
$smarty->assign_by_ref('hf', $hf);
$smarty->display('help/EditHelp.tpl');
Example #7
0
            }
        }
        Redirect::Page(URLBuilder::getURL(NULL, 'HelpList.php'));
        /*
        		$slf = new StationListFactory();
        
        		foreach ($ids as $id) {
        			$slf->GetByIdAndCompanyId($id, $current_company->getId() );
        			foreach ($slf as $station) {
        				$station->setDeleted($delete);
        				$station->Save();
        			}
        		}
        
        		Redirect::Page( URLBuilder::getURL(NULL, 'StationList.php') );
        */
        break;
    default:
        $hlf = new HelpListFactory();
        $hlf->getAll($current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array);
        $pager = new Pager($hlf);
        foreach ($hlf as $help_obj) {
            $help[] = array('id' => $help_obj->GetId(), 'type' => Option::getByKey($help_obj->getType(), $help_obj->getOptions('type')), 'status' => Option::getByKey($help_obj->getStatus(), $help_obj->getOptions('status')), 'heading' => $help_obj->getHeading(), 'private' => $help_obj->getPrivate(), 'deleted' => $help_obj->getDeleted());
        }
        $smarty->assign_by_ref('help_entries', $help);
        $smarty->assign_by_ref('sort_column', $sort_column);
        $smarty->assign_by_ref('sort_order', $sort_order);
        $smarty->assign_by_ref('paging_data', $pager->getPageVariables());
        break;
}
$smarty->display('help/HelpList.tpl');