本文整理汇总了PHP中df_display函数的典型用法代码示例。如果您正苦于以下问题:PHP df_display函数的具体用法?PHP df_display怎么用?PHP df_display使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了df_display函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
function handle(&$params)
{
if (!@$_REQUEST['email']) {
return PEAR::raiseError("No email address specified");
}
import('HTML/QuickForm.php');
$form = new HTML_QuickForm('opt_out_form', 'post');
$form->addElement('hidden', 'email', $_REQUEST['email']);
$form->addElement('hidden', '-action', 'email_opt_out');
$form->addElement('submit', 'submit', 'Cancel Subscription');
if ($form->validate()) {
$res = mysql_query("replace into dataface__email_blacklist (email) values ('" . addslashes($_REQUEST['email']) . "')", df_db());
if (!$res) {
trigger_error(mysql_error(df_db()), E_USER_ERROR);
}
header('Location: ' . DATAFACE_SITE_HREF . '?--msg=' . urlencode('You have successfully opted out of our mail list. You will no longer receive emails from us.'));
exit;
}
ob_start();
$form->display();
$html = ob_get_contents();
ob_end_clean();
$context = array();
$context['form'] = $html;
df_register_skin('email', DATAFACE_PATH . '/modules/Email/templates');
df_display($context, 'email/opt_out_form.html');
}
示例2: handle
function handle($params)
{
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
if (!isset($query['-relationship'])) {
return PEAR::raiseError("No relationship specified.");
}
$table =& Dataface_Table::loadTable($query['-table']);
$record =& $app->getRecord();
if (!$record) {
return Dataface_Error::permissionDenied("No record found");
}
$perms = $record->getPermissions(array('relationship' => $query['-relationship']));
if (!@$perms['view related records']) {
return Dataface_Error::permissionDenied('You don\'t have permission to view this relationship.');
}
$action = $table->getRelationshipsAsActions(array(), $query['-relationship']);
if (isset($query['-template'])) {
df_display(array('record' => $record), $query['-template']);
} else {
if (isset($action['template'])) {
df_display(array('record' => $record), $action['template']);
} else {
df_display(array('record' => $record), 'Dataface_Related_Records_List.html');
}
}
}
示例3: handle
function handle(&$params)
{
$app =& Dataface_Application::getInstance();
$record =& $app->getRecord();
$query =& $app->getQuery();
if (!isset($query['--subsearch'])) {
$query['--subsearch'] = '';
}
$results = array();
foreach ($record->_table->relationships() as $rname => $r) {
$fields = $r->fields(true);
$qstr = array();
foreach ($fields as $field) {
//list($tname, $field) = explode('.', $field);
$qstr[] = '`' . str_replace('`', '', $field) . "` LIKE '%" . addslashes($query['--subsearch']) . "%'";
}
$qstr = implode(' OR ', $qstr);
$results[$rname] = $record->getRelatedRecordObjects($rname, 0, 10, $qstr);
unset($r);
unset($fields);
}
if (@$query['--format'] == 'RSS2.0') {
$this->handleRSS($results);
} else {
df_display(array('results' => &$results, 'queryString' => $query['--subsearch']), 'Dataface_single_record_search.html');
}
}
示例4: handle
public function handle($params)
{
$uitk = Dataface_ModuleTool::getInstance()->loadModule('modules_uitk');
$uitk->registerPaths();
Dataface_JavascriptTool::getInstance()->import('swete/actions/import_translations.js');
df_display(array(), 'swete/actions/import_translations.html');
}
示例5: handle
function handle(&$params)
{
$app =& Dataface_Application::getInstance();
$record =& $app->getRecord();
$context = array();
if (!$record) {
return PEAR::raiseError("No record is currently selected", DATAFACE_E_ERROR);
}
$history_tablename = $record->_table->tablename . '__history';
if (!Dataface_Table::tableExists($history_tablename)) {
$context['error'] = PEAR::raiseError("This record has no history yet recorded.", DATAFACE_E_NOTICE);
} else {
import('Dataface/HistoryTool.php');
$history_tool = new Dataface_HistoryTool();
$history_log = $history_tool->getHistoryLog($record);
$context['log'] =& $history_log;
// let's make a query string for the current record
//current_record_qstr
$keys = array_keys($record->_table->keys());
$qstr = array();
foreach ($keys as $key) {
$qstr[] = urlencode('--__keys__[' . $key . ']') . '=' . urlencode($record->strval($key));
}
$context['current_record_qstr'] = implode('&', $qstr);
}
df_display($context, 'Dataface_RecordHistory.html');
}
示例6: handle
function handle($params)
{
$app = Dataface_Application::getInstance();
$jt = Dataface_JavascriptTool::getInstance();
$jt->import('xataface/view/tests/test_MasterDetailView.js');
df_display(array(), 'xataface/tests/test_MasterDetailView.html');
}
示例7: handle
function handle($params)
{
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
$record =& $app->getRecord();
if (!$record) {
return PEAR::raiseError("No record found.", DATAFACE_E_NOTICE);
}
if (!isset($query['-relationship'])) {
return PEAR::raiseError("No relationship specified.");
}
$table =& Dataface_Table::loadTable($query['-table']);
$action = $table->getRelationshipsAsActions(array(), $query['-relationship']);
if (@$action['permission'] and !$record->checkPermission($action['permission'])) {
return Dataface_Error::permissionDenied();
}
ob_start();
import('Dataface/RelationshipCheckboxForm.php');
$form = new Dataface_RelationshipCheckboxForm($record, $query['-relationship']);
$out = ob_get_contents();
ob_end_clean();
if (isset($query['-template'])) {
df_display(array('form' => $out), $query['-template']);
} else {
if (isset($action['template'])) {
df_display(array('form' => $out), $action['template']);
} else {
df_display(array('form' => $out), 'Dataface_related_records_checkboxes.html');
}
}
}
示例8: handle
function handle($params)
{
import('Dataface/SearchForm.php');
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
$new = true;
$form = new Dataface_SearchForm($query['-table'], $app->db(), $query);
$res = $form->_build();
if (PEAR::isError($res)) {
trigger_error($res->toString() . Dataface_Error::printStackTrace(), E_USER_ERROR);
}
/*
*
* We need to add the current GET parameter flags (the GET vars starting with '-') so
* that the controller knows to pass control to this method again upon form submission.
*
*/
$form->setDefaults(array('-action' => $query['-action']));
if ($form->validate()) {
$res = $form->process(array(&$form, 'performFind'));
}
$jt = Dataface_JavascriptTool::getInstance();
$jt->import('find.js');
ob_start();
$form->display();
$out = ob_get_contents();
ob_end_clean();
$context = array('form' => &$out);
df_display($context, 'Dataface_Find_View.html', true);
}
示例9: handle
function handle(&$params)
{
try {
$app = Dataface_Application::getInstance();
$query =& $app->getQuery();
$jt = Dataface_JavascriptTool::getInstance();
$jt->import('swete/ui/filter_translations.js');
$app->addHeadContent('<link rel="stylesheet" type="text/css" href="css/swete/actions/review_translations.css"/>');
if (!@$query['-recordid']) {
throw new Exception("No record id was specified");
}
$record = df_get_record_by_id($query['-recordid']);
$job = new SweteJob($record);
$tm = XFTranslationMemory::loadTranslationMemoryFor($record, $record->val('source_language'), $record->val('destination_language'));
$translations = $job->getTranslations();
$template = 'swete/actions/review_translations.html';
if (@$query['-isDialog']) {
$template = 'swete/actions/review_translations_dlg.html';
}
df_display(array('job' => $job, 'translations' => $translations), $template);
} catch (Exception $e) {
if ($e->getCode() == E_USER_ERROR) {
echo $e->getMessage();
} else {
throw $e;
}
}
}
示例10: toHtml
function toHtml()
{
ob_start();
df_display(array('records' => &$this->records, 'list' => &$this), 'Dataface_GlanceList.html');
$out = ob_get_contents();
ob_end_clean();
return $out;
}
示例11: toHtml
public function toHtml()
{
\Dataface_JavascriptTool::getInstance()->import('xataface/components/Portlet.js');
ob_start();
df_display(array('portlet' => $this), 'xataface/components/Portlet.html');
$contents = ob_get_contents();
ob_end_clean();
return $contents;
}
示例12: handle
function handle($params)
{
$js = Dataface_JavascriptTool::getInstance();
$js->import('tests/doctest.js');
$js->setMinify(false);
$js->setUseCache(false);
df_register_skin('xatajax', XATAJAX_PATH . DIRECTORY_SEPARATOR . 'templates');
df_display(array(), 'tests/doctest.html');
}
示例13: installationForm
function installationForm($params, $env)
{
//if ( $this->step != __FUNCTION__ ) return false;
if (isset($_POST['--process-installationForm'])) {
$required = array('host', 'name', 'user');
}
df_display(array('pipeline_vars' => &$env, 'params' => &$params, 'validation_result' => &$res, 'repository_apps' => array()), 'installationForm.html');
return;
}
示例14: handle
function handle(&$params)
{
$app =& Dataface_Application::getInstance();
$tt = new Dataface_TranslationTool();
if (!Dataface_Table::tableExists('dataface__translation_submissions', false)) {
$tt->createTranslationSubmissionsTable();
header('Location: ' . $app->url(''));
exit;
}
if (!@$_POST['--submit']) {
df_display(array('query' => $app->getQuery(), 'success' => @$_REQUEST['--success']), 'Dataface_submit_translation.html');
exit;
} else {
if (@$_POST['subject']) {
// This is a dummy field - possible hacking attempt
header('Location: ' . $app->url('-action=list'));
exit;
}
if (@$_POST['--recordid']) {
$record = df_get_record_by_id($_POST['--recordid']);
$values = array('record_id' => @$_POST['--recordid'], 'language' => @$_POST['--language'], 'url' => @$_POST['--url'], 'original_text' => @$_POST['--original_text'], 'translated_text' => @$_POST['--translated_text'], 'translated_by' => @$_POST['--translated_by']);
$trec = new Dataface_Record('dataface__translation_submissions', array());
$trec->setValues($values);
$trec->save();
$email = <<<END
The following translation was submitted to the web site {$app->url('')}:
Translation for record {$record->getTitle()} which can be viewed at {$record->getURL('-action=view')}.
This translation was submitted by {$_POST['--translated_by']} after viewing the content at {$_POST['--url']}.
The original text that was being translated is as follows:
{$_POST['--original_text']}
The translation proposed by this person is as follows:
{$_POST['--translated_text']}
For more details about this translation, please visit {$trec->getURL('-action=view')}.
END;
if (@$app->_conf['admin_email']) {
mail($app->_conf['admin_email'], 'New translation submitted', $email);
}
if (@$_POST['--redirect'] || @$_POST['--url']) {
$url = @$_POST['--redirect'] ? $_POST['--redirect'] : $_POST['--url'];
header('Location: ' . $url . '&--msg=' . urlencode('Thank you for your submission.'));
exit;
} else {
header('Location: ' . $app->url('') . '&--success=1&--msg=' . urlencode('Thank you for your submission.'));
exit;
}
} else {
trigger_error("No record id was provided", E_USER_ERROR);
}
}
}
示例15: handle
function handle(&$params)
{
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
$this->table =& Dataface_Table::loadTable($query['-table']);
$translations =& $this->table->getTranslations();
foreach (array_keys($translations) as $trans) {
$this->table->getTranslation($trans);
}
//print_r($translations);
if (!isset($translations) || count($translations) < 2) {
// there are no translations to be made
trigger_error('Attempt to translate a record in a table "' . $this->table->tablename . '" that contains no translations.', E_USER_ERROR);
}
$this->translatableLanguages = array_keys($translations);
$translatableLanguages =& $this->translatableLanguages;
$this->languageCodes = new I18Nv2_Language($app->_conf['lang']);
$languageCodes =& $this->languageCodes;
$currentLanguage = $languageCodes->getName($app->_conf['lang']);
if (count($translatableLanguages) < 2) {
return PEAR::raiseError(df_translate('Not enough languages to translate', 'There aren\'t enough languages available to translate.'), DATAFACE_E_ERROR);
}
//$defaultSource = $translatableLanguages[0];
//$defaultDest = $translatableLanguages[1];
$options = array();
foreach ($translatableLanguages as $lang) {
$options[$lang] = $languageCodes->getName($lang);
}
unset($options[$app->_conf['default_language']]);
$tt = new Dataface_TranslationTool();
$form = new HTML_QuickForm('StatusForm', 'POST');
$form->addElement('select', '--language', 'Translation', $options);
$form->addElement('select', '--status', 'Status', $tt->translation_status_codes);
//$form->setDefaults( array('-sourceLanguage'=>$defaultSource, '-destinationLanguage'=>$defaultDest));
$form->addElement('submit', '--set_status', 'Set Status');
foreach ($query as $key => $value) {
$form->addElement('hidden', $key);
$form->setDefaults(array($key => $value));
}
if ($form->validate()) {
$res = $form->process(array(&$this, 'processForm'));
if (PEAR::isError($res)) {
return $res;
} else {
header('Location: ' . $app->url('-action=list&-sourceLanguage=&-destinationLanguage=&-translate=') . '&--msg=' . urlencode('Translation status successfully set.'));
exit;
}
}
ob_start();
$form->display();
$out = ob_get_contents();
ob_end_clean();
$records =& $this->getRecords();
df_display(array('form' => $out, 'translationTool' => &$tt, 'records' => &$records, 'translations' => &$options, 'context' => &$this), 'Dataface_set_translation_status.html');
}