本文整理汇总了PHP中Piwi类的典型用法代码示例。如果您正苦于以下问题:PHP Piwi类的具体用法?PHP Piwi怎么用?PHP Piwi使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Piwi类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: Groups
/**
* Displays phoo groups administration panel
*
* @access public
* @return string XHTML template content
*/
function Groups()
{
$this->gadget->CheckPermission('Groups');
$this->AjaxMe('script.js');
$tpl = $this->gadget->template->loadAdmin('Groups.html');
$tpl->SetBlock('groups');
// Header
$tpl->SetVariable('menubar', $this->MenuBar('Groups'));
// Meta keywords
$name =& Piwi::CreateWidget('Entry', 'name', '');
$tpl->SetVariable('lbl_name', _t('GLOBAL_NAME'));
$tpl->SetVariable('name', $name->Get());
// Fast URL
$fastUrlEntry =& Piwi::CreateWidget('Entry', 'fast_url', '');
$fastUrlEntry->SetId('fast_url');
$fastUrlEntry->SetStyle('width: 100%');
$tpl->SetVariable('lbl_fast_url', _t('PHOO_FASTURL'));
$tpl->SetVariable('fast_url', $fastUrlEntry->Get());
// Meta keywords
$metaKeywords =& Piwi::CreateWidget('Entry', 'meta_keywords', '');
$metaKeywords->SetStyle('width: 100%;');
$tpl->SetVariable('lbl_meta_keywords', _t('GLOBAL_META_KEYWORDS'));
$tpl->SetVariable('meta_keywords', $metaKeywords->Get());
// Meta Description
$metaDesc =& Piwi::CreateWidget('Entry', 'meta_description', '');
$metaDesc->SetStyle('width: 100%;');
$tpl->SetVariable('lbl_meta_description', _t('GLOBAL_META_DESCRIPTION'));
$tpl->SetVariable('meta_description', $metaDesc->Get());
// description
$entry =& Piwi::CreateWidget('TextArea', 'description', '');
$entry->SetId('description');
$entry->SetRows(4);
$entry->SetColumns(30);
$entry->SetStyle('width: 99%; direction: ltr; white-space: nowrap;');
$tpl->SetVariable('lbl_description', _t('GLOBAL_DESCRIPTION'));
$tpl->SetVariable('description', $entry->Get());
$tpl->SetVariable('addGroupTitle', _t('PHOO_GROUPS_ADD_GROUP'));
$tpl->SetVariable('editGroupTitle', _t('PHOO_GROUPS_EDIT_GROUP'));
$tpl->SetVariable('confirmGroupDelete', _t('PHOO_GROUPS_CONFIRM_DELETE'));
$tpl->SetVariable('incompleteGroupFields', _t('PHOO_GROUPS_INCOMPLETE_GROUP_FIELDS'));
$tpl->SetVariable('delete', _t('GLOBAL_DELETE'));
$tpl->SetVariable('cancel', _t('GLOBAL_CANCEL'));
$tpl->SetVariable('save', _t('GLOBAL_SAVE'));
$tpl->SetVariable('delete_icon', STOCK_DELETE);
$tpl->SetVariable('save_icon', STOCK_SAVE);
$tpl->SetVariable('cancel_icon', STOCK_CANCEL);
//Fill the groups combo..
$comboGroups =& Piwi::CreateWidget('Combo', 'groups_combo');
$comboGroups->SetSize(14);
$comboGroups->AddEvent(ON_CHANGE, 'javascript:editGroup(this.value);');
$comboGroups->SetStyle('width: 100%;');
$model = $this->gadget->model->load('Groups');
$groups = $model->GetGroups();
foreach ($groups as $group) {
$comboGroups->AddOption($group['name'], $group['id']);
}
$tpl->SetVariable('combo', $comboGroups->Get());
$tpl->ParseBlock('groups');
return $tpl->Get();
}
开发者ID:Dulciane,项目名称:jaws,代码行数:66,代码来源:Groups.php
示例2: Reports
/**
* View report
*
* @access public
* @return string XHTML template content
*/
function Reports()
{
$this->gadget->CheckPermission('ViewReports');
$this->AjaxMe('script.js');
$model = $this->gadget->model->load('Group');
$tpl = $this->gadget->template->loadAdmin('Reports.html');
$tpl->SetBlock('Reports');
//Menu bar
$tpl->SetVariable('menubar', $this->MenuBar('Reports'));
$tpl->SetVariable('lbl_pollgroups', _t('POLL_GROUPS'));
$groupsCombo =& Piwi::CreateWidget('Combo', 'pollgroups');
$groupsCombo->SetID('pollgroups');
$groupsCombo->AddEvent(ON_CHANGE, "javascript:getGroupPolls(this.value);");
$groups = $model->GetPollGroups();
$groupsCombo->AddOption('', 0);
foreach ($groups as $group) {
$groupsCombo->AddOption($group['title'], $group['id']);
}
$tpl->SetVariable('pollgroups_combo', $groupsCombo->Get());
$tpl->SetVariable('lbl_grouppolls', _t('POLL_POLLS'));
$pollsCombo =& Piwi::CreateWidget('Combo', 'grouppolls');
$pollsCombo->SetID('grouppolls');
$pollsCombo->SetSize(15);
$pollsCombo->AddEvent(ON_CHANGE, 'javascript:showResult(this.value);');
$tpl->SetVariable('grouppolls_combo', $pollsCombo->Get());
$tpl->ParseBlock('Reports');
return $tpl->Get();
}
开发者ID:Dulciane,项目名称:jaws,代码行数:34,代码来源:Report.php
示例3: ShareForm
/**
* Fetches list of system user groups
*
* @access public
* @return array Array of groups or an empty array
*/
function ShareForm()
{
$tpl = $this->gadget->template->load('Share.html');
$tpl->SetBlock('share');
$tpl->SetVariable('lbl_shared_for', _t('DIRECTORY_SHARED_FOR'));
$tpl->SetVariable('lbl_public', _t('DIRECTORY_FILE_PUBLIC_URL'));
$tpl->SetVariable('lbl_make_public', _t('DIRECTORY_FILE_MAKE_PUBLIC'));
// Edit UI
if ($this->gadget->GetPermission('ShareFile')) {
$tpl->SetBlock('share/edit');
$tpl->SetVariable('lbl_groups', _t('DIRECTORY_GROUPS'));
$tpl->SetVariable('lbl_users', _t('DIRECTORY_USERS'));
$uModel = new Jaws_User();
$groups = $uModel->GetGroups(true, 'title');
if (!Jaws_Error::IsError($groups)) {
$combo =& Piwi::CreateWidget('Combo', 'groups');
$combo->AddEvent(ON_CHANGE, 'toggleUsers(this.value)');
$combo->AddOption('All Users', 0);
foreach ($groups as $group) {
$combo->AddOption($group['title'], $group['id']);
}
$tpl->SetVariable('groups', $combo->Get());
}
$tpl->ParseBlock('share/edit');
$tpl->SetBlock('share/actions');
$tpl->SetVariable('lbl_ok', _t('GLOBAL_OK'));
$tpl->SetVariable('lbl_cancel', _t('GLOBAL_CANCEL'));
$tpl->ParseBlock('share/actions');
}
$tpl->ParseBlock('share');
return $tpl->Get();
}
开发者ID:juniortux,项目名称:jaws,代码行数:38,代码来源:Share.php
示例4: Properties
/**
* Builds admin properties UI
*
* @access public
* @return string XHTML form
*/
function Properties()
{
$this->gadget->CheckPermission('Settings');
$this->AjaxMe('script.js');
$tpl = $this->gadget->template->loadAdmin('Settings.html');
$tpl->SetBlock('Settings');
// view tag result limit
$limit = (int) $this->gadget->registry->fetch('tag_results_limit');
$limitCombo =& Piwi::CreateWidget('Combo', 'tag_results_limit');
$limitCombo->SetTitle(_t('TAGS_DISPLAY_RESULTS_LIMIT'));
$limitCombo->AddOption(5, 5);
$limitCombo->AddOption(10, 10);
$limitCombo->AddOption(15, 15);
$limitCombo->AddOption(20, 20);
$limitCombo->AddOption(30, 30);
$limitCombo->AddOption(50, 50);
$limitCombo->SetDefault($limit > 0 ? $limit : 10);
$tpl->SetVariable('lbl_tag_results_limit', _t('TAGS_RESULT_LIMIT'));
$tpl->SetVariable('tag_results_limit', $limitCombo->Get());
$save =& Piwi::CreateWidget('Button', 'save', _t('GLOBAL_SAVE'), STOCK_SAVE);
$save->AddEvent(ON_CLICK, 'javascript:saveSettings();');
$tpl->SetVariable('btn_save', $save->Get());
$tpl->SetVariable('menubar', $this->MenuBar('Properties'));
$tpl->ParseBlock('Settings');
return $tpl->Get();
}
开发者ID:uda,项目名称:jaws,代码行数:32,代码来源:Settings.php
示例5: Settings
/**
* Builds admin settings UI
*
* @access public
* @return string XHTML form
*/
function Settings()
{
$this->gadget->CheckPermission('ManageSettings');
$this->AjaxMe('script.js');
$tpl = $this->gadget->template->loadAdmin('Settings.html');
$tpl->SetBlock('Settings');
// Log Priority Level
$priority_level = (int) $this->gadget->registry->fetch('log_priority_level');
$priorityCombo =& Piwi::CreateWidget('Combo', 'priority');
$priorityCombo->AddOption(_t('LOGS_PRIORITY_5'), JAWS_WARNING, false);
$priorityCombo->AddOption(_t('LOGS_PRIORITY_6'), JAWS_NOTICE, false);
$priorityCombo->AddOption(_t('LOGS_PRIORITY_7'), JAWS_INFO, false);
$priorityCombo->SetDefault($priority_level);
$tpl->SetVariable('lbl_priority', _t('LOGS_SETTINGS_DEFAULT_LOG_PRIORITY'));
$tpl->SetVariable('priority', $priorityCombo->Get());
// Log Parameters?
$log_parameters = (int) $this->gadget->registry->fetch('log_parameters');
$logParametersCombo =& Piwi::CreateWidget('Combo', 'log_parameters');
$logParametersCombo->AddOption(_t('GLOBAL_YES'), 1, false);
$logParametersCombo->AddOption(_t('GLOBAL_NO'), 0, false);
$logParametersCombo->SetDefault($log_parameters);
$tpl->SetVariable('lbl_log_parameters', _t('LOGS_SETTINGS_LOG_PARAMETERS'));
$tpl->SetVariable('log_parameters', $logParametersCombo->Get());
$save =& Piwi::CreateWidget('Button', 'save', _t('GLOBAL_SAVE'), STOCK_SAVE);
$save->AddEvent(ON_CLICK, 'javascript:saveSettings();');
$tpl->SetVariable('btn_save', $save->Get());
$tpl->SetVariable('menubar', $this->MenuBar('Settings'));
$tpl->ParseBlock('Settings');
return $tpl->Get();
}
开发者ID:Dulciane,项目名称:jaws,代码行数:36,代码来源:Settings.php
示例6: EditCategory
/**
* Edit a category
*
* @access public
* @return string XHTML Category form content
*/
function EditCategory()
{
$this->gadget->CheckPermission('ManageCategories');
$this->AjaxMe('script.js');
$category = jaws()->request->fetch('category', 'get');
if (!is_null($category)) {
$model = $this->gadget->model->loadAdmin('Category');
$cat = $model->GetCategory($category);
}
$tpl = $this->gadget->template->loadAdmin('Faq.html');
$tpl->SetBlock('edit_category');
$tpl->SetVariable('menubar', $this->MenuBar('AddNewCategory'));
//Add Faq Form
$faqform =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'post');
$faqform->SetStyle('width: 100%;');
$faqform->Add(Piwi::CreateWidget('HiddenEntry', 'gadget', 'Faq'));
if (isset($cat)) {
$faqform->Add(Piwi::CreateWidget('HiddenEntry', 'id', $category));
$faqform->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'UpdateCategory'));
} else {
$faqform->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'NewCategory'));
}
$catbox =& Piwi::CreateWidget('VBox');
$catTitle = isset($cat) ? $cat['category'] : '';
$catentry =& Piwi::CreateWidget('Entry', 'category', $catTitle);
$catentry->SetTitle(_t('FAQ_CATEGORY'));
$catentry->SetStyle('width: 500px;');
$catbox->PackStart($catentry);
$fasturl = isset($cat) ? $cat['fast_url'] : '';
$cfasturl =& Piwi::CreateWidget('Entry', 'fast_url', $fasturl);
$cfasturl->SetTitle(_t('FAQ_FASTURL'));
$cfasturl->SetStyle('direction: ltr; width: 500px;');
$catbox->PackStart($cfasturl);
$desc = isset($cat) ? $cat['description'] : '';
$editor =& $GLOBALS['app']->LoadEditor('Faq', 'description', $desc, false, _t('GLOBAL_DESCRIPTION'));
$editor->TextArea->SetStyle('width: 100%;');
$editor->TextArea->SetRows(8);
$faqform->Add($catbox);
$faqform->Add($editor);
if (isset($cat)) {
$submit =& Piwi::CreateWidget('Button', 'updcat', _t('FAQ_UPDATE_CATEGORY'), STOCK_SAVE);
} else {
$submit =& Piwi::CreateWidget('Button', 'newcat', _t('FAQ_ADD_CATEGORY'), STOCK_SAVE);
}
$submit->SetSubmit();
$cancel =& Piwi::CreateWidget('Button', 'cancel', _t('GLOBAL_CANCEL'), STOCK_CANCEL);
$cancel->AddEvent(ON_CLICK, "javascript: window.location = '" . BASE_SCRIPT . '?gadget=Faq' . "';");
$preview =& Piwi::CreateWidget('Button', 'previewButton', _t('GLOBAL_PREVIEW'), STOCK_PRINT_PREVIEW);
$preview->AddEvent(ON_CLICK, 'javascript: parseCategoryText(this.form);');
$buttonbox =& Piwi::CreateWidget('HBox');
$buttonbox->SetStyle(_t('GLOBAL_LANG_DIRECTION') == 'rtl' ? 'float: left;' : 'float: right;');
$buttonbox->PackStart($preview);
$buttonbox->PackStart($cancel);
$buttonbox->PackStart($submit);
$faqform->Add($buttonbox);
$tpl->SetVariable('form', $faqform->Get());
$tpl->ParseBlock('edit_category');
return $tpl->Get();
}
开发者ID:juniortux,项目名称:jaws,代码行数:65,代码来源:Category.php
示例7: GetWebControl
/**
* Overrides, Gets the WebControl of this plugin
*
* @access public
* @param string $textarea The textarea
* @return string XHTML WebControl
*/
function GetWebControl($textarea)
{
$button =& Piwi::CreateWidget('Button', 'addalbumcover', '', $GLOBALS['app']->getSiteURL('/plugins/AlbumCover/images/stock-album.png', true));
$button->SetTitle(_t('PLUGINS_ALBUMCOVER_ADD') . ' ALT+A');
$button->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}','[AlbumCover Artist=\\'\\' Album=\\'\\']','','');");
$button->SetAccessKey('A');
return $button;
}
开发者ID:Dulciane,项目名称:jaws,代码行数:15,代码来源:Plugin.php
示例8: GetWebControl
/**
* Overrides, Gets the WebControl of this plugin
*
* @access public
* @param string $textarea The textarea
* @return string XHTML WebControl
*/
function GetWebControl($textarea)
{
$button =& Piwi::CreateWidget('Button', 'addbridge', '', $GLOBALS['app']->getSiteURL('/plugins/SmartBridge/images/smart-bridge-stock.png', true));
$button->SetTitle(_t('PLUGINS_SMARTBRIDGE_ADD') . ' ALT+B');
$button->AddEvent(ON_CLICK, "javascript: insertTags('{$textarea}','[a:Gadget:FastURL]','[/a]','" . _t('PLUGINS_SMARTBRIDGE_SAMPLE') . "');");
$button->SetAccessKey('B');
return $button;
}
开发者ID:juniortux,项目名称:jaws,代码行数:15,代码来源:Plugin.php
示例9: ManageCategories
/**
* Displays blog categories manager
*
* @access public
* @param string $second_action
* @return string XHTML template content
*/
function ManageCategories($second_action = '')
{
$this->gadget->CheckPermission('ManageCategories');
$this->AjaxMe('script.js');
$tpl = $this->gadget->template->loadAdmin('Categories.html');
$tpl->SetBlock('categories');
// Menubar
$tpl->SetVariable('menubar', $this->MenuBar('ManageCategories'));
$tpl->SetVariable('categories', _t('BLOG_CATEGORIES'));
$model = $this->gadget->model->load('Categories');
$categories = $model->GetCategories();
$combo =& Piwi::CreateWidget('Combo', 'category_id');
$combo->SetID('category_id');
$combo->SetStyle('width: 100%; margin-bottom: 10px;');
$combo->SetSize(18);
$combo->AddEvent(ON_CHANGE, 'editCategory(this.value)');
foreach ($categories as $cat) {
$combo->AddOption($cat['name'], $cat['id']);
}
$tpl->SetVariable('combo', $combo->Get());
// Category form
$catName =& Piwi::CreateWidget('Entry', 'name', '');
$catName->setStyle('width: 300px;');
$tpl->SetVariable('lbl_name', _t('BLOG_CATEGORY'));
$tpl->SetVariable('name', $catName->Get());
$catFastURL =& Piwi::CreateWidget('Entry', 'fast_url', '');
$catFastURL->setStyle('width: 300px;');
$tpl->SetVariable('lbl_fast_url', _t('BLOG_FASTURL'));
$tpl->SetVariable('fast_url', $catFastURL->Get());
$metaKeywords =& Piwi::CreateWidget('Entry', 'meta_keywords', '');
$metaKeywords->setStyle('width: 300px;');
$tpl->SetVariable('lbl_meta_keywords', _t('GLOBAL_META_KEYWORDS'));
$tpl->SetVariable('meta_keywords', $metaKeywords->Get());
$metaDesc =& Piwi::CreateWidget('Entry', 'meta_desc', '');
$metaDesc->setStyle('width: 300px;');
$tpl->SetVariable('lbl_meta_desc', _t('GLOBAL_META_DESCRIPTION'));
$tpl->SetVariable('meta_desc', $metaDesc->Get());
$catDescription =& Piwi::CreateWidget('TextArea', 'description', '');
$catDescription->setStyle('width: 300px;');
$tpl->SetVariable('lbl_description', _t('GLOBAL_DESCRIPTION'));
$tpl->SetVariable('description', $catDescription->Get());
$btnDelete =& Piwi::CreateWidget('Button', 'btn_delete', _t('GLOBAL_DELETE'), STOCK_DELETE);
$btnDelete->AddEvent(ON_CLICK, 'javascript:deleteCategory();');
$btnDelete->SetStyle('display: none;');
$tpl->SetVariable('btn_delete', $btnDelete->Get());
$btnCancel =& Piwi::CreateWidget('Button', 'btn_cancel', _t('GLOBAL_CANCEL'), STOCK_CANCEL);
$btnCancel->AddEvent(ON_CLICK, 'javascript:stopAction();');
$tpl->SetVariable('btn_cancel', $btnCancel->Get());
$btnSave =& Piwi::CreateWidget('Button', 'btn_save', _t('GLOBAL_SAVE'), STOCK_SAVE);
$btnSave->AddEvent(ON_CLICK, 'javascript:saveCategory(this.form);');
$tpl->SetVariable('btn_save', $btnSave->Get());
$tpl->SetVariable('delete_message', _t('BLOG_DELETE_CONFIRM_CATEGORY'));
$tpl->SetVariable('incompleteCategoryFields', _t('BLOG_CATEGORY_INCOMPLETE_FIELDS'));
$tpl->SetVariable('addCategory_title', _t('BLOG_NEW_CATEGORY'));
$tpl->SetVariable('editCategory_title', _t('BLOG_EDIT_CATEGORY'));
$tpl->ParseBlock('categories');
return $tpl->Get();
}
开发者ID:Dulciane,项目名称:jaws,代码行数:65,代码来源:Categories.php
示例10: DisplayWhen
/**
* Changes when to display a given gadget
*
* @access public
* @return XHTML template content
*/
function DisplayWhen()
{
$rqst = jaws()->request->fetch(array('id', 'layout'), 'get');
$layout = empty($rqst['layout']) ? 'Layout' : $rqst['layout'];
// check permissions
if ($layout == 'Index.Dashboard') {
$GLOBALS['app']->Session->CheckPermission('Users', 'ManageDashboard');
} else {
$GLOBALS['app']->Session->CheckPermission('Users', 'ManageLayout');
}
$model = $this->gadget->model->loadAdmin('Elements');
$tpl = $this->gadget->template->load('DisplayWhen.html');
$tpl->SetBlock('template');
$direction = _t('GLOBAL_LANG_DIRECTION');
$dir = $direction == 'rtl' ? '.' . $direction : '';
$brow = $GLOBALS['app']->GetBrowserFlag();
$brow = empty($brow) ? '' : '.' . $brow;
$base_url = $GLOBALS['app']->GetSiteURL('/');
$tpl->SetVariable('BASE_URL', $base_url);
$tpl->SetVariable('.dir', $dir);
$tpl->SetVariable('.browser', $brow);
$tpl->SetVariable('base_script', BASE_SCRIPT);
$tpl->SetVariable('lbl_when', _t('LAYOUT_DISPLAY'));
$layoutElement = $model->GetElement($rqst['id']);
if (is_array($layoutElement) && !empty($layoutElement)) {
$dw_value = $layoutElement['when'];
}
$displayCombo =& Piwi::CreateWidget('Combo', 'display_in');
$displayCombo->AddOption(_t('LAYOUT_ALWAYS'), 'always');
$displayCombo->AddOption(_t('LAYOUT_ONLY_IN_GADGET'), 'selected');
if ($dw_value == '*') {
$displayCombo->SetDefault('always');
$tpl->SetVariable('selected_display', 'none');
} else {
$displayCombo->SetDefault('selected');
$tpl->SetVariable('selected_display', 'block');
}
$displayCombo->AddEvent(ON_CHANGE, "showGadgets();");
$tpl->SetVariable('display_in_combo', $displayCombo->Get());
// Display in list
$selectedGadgets = explode(',', $dw_value);
// for index...
$gadget_field =& Piwi::CreateWidget('CheckButtons', 'checkbox_index', 'vertical');
$gadget_field->AddOption(_t('LAYOUT_INDEX'), 'index', null, in_array('index', $selectedGadgets));
$cmpModel = Jaws_Gadget::getInstance('Components')->model->load('Gadgets');
$gadget_list = $cmpModel->GetGadgetsList(null, true, true, true);
foreach ($gadget_list as $g) {
$gadget_field->AddOption($g['title'], $g['name'], null, in_array($g['name'], $selectedGadgets));
}
$tpl->SetVariable('selected_gadgets', $gadget_field->Get());
$saveButton =& Piwi::CreateWidget('Button', 'ok', _t('GLOBAL_SAVE'), STOCK_SAVE);
$saveButton->AddEvent(ON_CLICK, "parent.parent.saveChangeDW(" . $layoutElement['id'] . ", getSelectedGadgets());");
$tpl->SetVariable('save', $saveButton->Get());
$tpl->ParseBlock('template');
return $tpl->Get();
}
开发者ID:uda,项目名称:jaws,代码行数:62,代码来源:DisplayWhen.php
示例11: Settings
/**
* Displays shoutbox Settings
*
* @access public
* @return string XHTML template content
*/
function Settings()
{
$this->AjaxMe('script.js');
$tpl = $this->gadget->template->loadAdmin('Settings.html');
$tpl->SetBlock('settings');
$tpl->SetVariable('menubar', $this->MenuBar('Settings'));
///Config properties
if ($this->gadget->GetPermission('UpdateProperties')) {
$form =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'POST');
$form->Add(Piwi::CreateWidget('HiddenEntry', 'gadget', 'Shoutbox'));
$form->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'UpdateProperties'));
include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php';
$fieldset = new Jaws_Widgets_FieldSet(_t('SHOUTBOX_SETTINGS'));
$fieldset->SetDirection('vertical');
//
$limitcombo =& Piwi::CreateWidget('Combo', 'limit_entries');
$limitcombo->SetTitle(_t('SHOUTBOX_ENTRY_LIMIT'));
for ($i = 1; $i <= 20; ++$i) {
$limitcombo->AddOption($i, $i);
}
$limit = $this->gadget->registry->fetch('limit');
if (Jaws_Error::IsError($limit)) {
$limit = 10;
}
$limitcombo->SetDefault($limit);
$fieldset->Add($limitcombo);
// max length
$max_lencombo =& Piwi::CreateWidget('Combo', 'max_strlen');
$max_lencombo->SetTitle(_t('SHOUTBOX_ENTRY_MAX_LEN'));
for ($i = 1; $i <= 10; ++$i) {
$max_lencombo->AddOption($i * 25, $i * 25);
}
$max_strlen = $this->gadget->registry->fetch('max_strlen');
if (Jaws_Error::IsError($max_strlen)) {
$max_strlen = 125;
}
$max_lencombo->SetDefault($max_strlen);
$fieldset->Add($max_lencombo);
//Anonymous post authority
$authority =& Piwi::CreateWidget('Combo', 'authority');
$authority->SetTitle(_t('SHOUTBOX_ANON_POST_AUTHORITY'));
$authority->AddOption(_t('GLOBAL_DISABLED'), 'false');
$authority->AddOption(_t('GLOBAL_ENABLED'), 'true');
$anon_authority = $this->gadget->registry->fetch('anon_post_authority');
$authority->SetDefault($anon_authority == 'true' ? 'true' : 'false');
$fieldset->Add($authority);
$form->Add($fieldset);
$submit =& Piwi::CreateWidget('Button', 'saveproperties', _t('GLOBAL_SAVE'), STOCK_SAVE);
$submit->AddEvent(ON_CLICK, 'javascript: updateProperties(this.form);');
$form->Add($submit);
$tpl->SetVariable('config_form', $form->Get());
}
$tpl->ParseBlock('settings');
return $tpl->Get();
}
开发者ID:juniortux,项目名称:jaws,代码行数:61,代码来源:Settings.php
示例12: Import
/**
* Import pictures in 'import' folder
*
* @access public
* @return string XHTML template content
*/
function Import()
{
$this->gadget->CheckPermission('Import');
$tpl = $this->gadget->template->loadAdmin('Import.html');
$tpl->SetBlock('import');
$tpl->SetVariable('base_script', BASE_SCRIPT);
$tpl->SetVariable('menubar', $this->MenuBar('Import'));
$iModel = $this->gadget->model->loadAdmin('Import');
$aModel = $this->gadget->model->load('Albums');
$items = $iModel->GetItemsToImport();
if (count($items) > 0) {
$tpl->SetBlock('import/pictures');
$tpl->SetVariable('ready_to_import', _t('PHOO_READY_TO_IMPORT', count($items)));
$gadget =& Piwi::CreateWidget('HiddenEntry', 'gadget', 'Phoo');
$tpl->SetVariable('gadget_hidden', $gadget->Get());
$action =& Piwi::CreateWidget('HiddenEntry', 'action', 'FinishImport');
$tpl->SetVariable('action_hidden', $action->Get());
$tpl->SetVariable('import_message', _t('PHOO_IMPORT_MESSAGE'));
$albumcombo =& Piwi::CreateWidget('Combo', 'album', _t('PHOO_ALBUM'));
$first = false;
$albums = $aModel->GetAlbums('name', 'ASC');
if (!Jaws_Error::IsError($albums) && !empty($albums)) {
foreach ($albums as $a) {
if (!$first) {
$first = $a['id'];
}
$albumcombo->AddOption($a['name'], $a['id']);
}
}
$albumcombo->SetDefault($first);
$tpl->SetVariable('albums_combo', $albumcombo->Get());
$b =& Piwi::CreateWidget('Button', 'import_button', _t('PHOO_IMPORT'), STOCK_DOWN);
$b->SetSubmit(true);
$tpl->SetVariable('import_button', $b->Get());
$counter = 0;
include_once JAWS_PATH . 'include/Jaws/Image.php';
foreach ($items as $i) {
$tpl->SetBlock('import/pictures/item');
$tpl->SetVariable('thumb', BASE_SCRIPT . '?gadget=Phoo&action=Thumb&image=' . $i);
$tpl->SetVariable('filename', $i);
$tpl->SetVariable('entryname', md5($i));
$tpl->SetVariable('counter', (string) $counter);
$tpl->ParseBlock('import/pictures/item');
$counter++;
}
$tpl->ParseBlock('import/pictures');
} else {
$tpl->SetBlock('import/noitems');
$tpl->SetVariable('no_items_to_import', _t('PHOO_NO_IMAGES_TO_IMPORT'));
$tpl->SetVariable('message', _t('PHOO_IMPORT_INSTRUCTIONS'));
$tpl->ParseBlock('import/noitems');
}
$tpl->ParseBlock('import');
return $tpl->Get();
}
开发者ID:Dulciane,项目名称:jaws,代码行数:61,代码来源:Import.php
示例13: ShareEvent
/**
* Builds sharing UI
*
* @access public
* @return string XHTML UI
*/
function ShareEvent()
{
// Fetch event
$id = (int) jaws()->request->fetch('id', 'get');
$model = $this->gadget->model->load('Event');
$uid = (int) $GLOBALS['app']->Session->GetAttribute('user');
$event = $model->GetEvent($id, $uid);
if (Jaws_Error::IsError($event) || empty($event) || $event['user'] != $uid) {
return;
}
$this->AjaxMe('site_script.js');
$tpl = $this->gadget->template->load('ShareEvent.html');
$tpl->SetBlock('share');
$tpl->SetVariable('title', _t('EVENTSCALENDAR_SHARE'));
$tpl->SetVariable('id', $id);
$tpl->SetVariable('UID', $uid);
$tpl->SetVariable('subject', $event['subject']);
$tpl->SetVariable('lbl_users', _t('EVENTSCALENDAR_USERS'));
$tpl->SetVariable('events_url', $this->gadget->urlMap('ManageEvents'));
// User groups
$uModel = new Jaws_User();
$groups = $uModel->GetGroups($uid, true, 'title');
if (!Jaws_Error::IsError($groups)) {
$combo =& Piwi::CreateWidget('Combo', 'sys_groups');
$combo->AddEvent(ON_CHANGE, 'toggleUsers(this.value)');
$combo->AddOption(_t('EVENTSCALENDAR_ALL_USERS'), 0);
foreach ($groups as $group) {
$combo->AddOption($group['title'], $group['id']);
}
$tpl->SetVariable('groups', $combo->Get());
}
$tpl->SetVariable('lbl_groups', _t('EVENTSCALENDAR_GROUPS'));
// Event users
$model = $this->gadget->model->load('Share');
$combo =& Piwi::CreateWidget('Combo', 'event_users');
$combo->SetSize(10);
$users = $model->GetEventUsers($id);
if (!Jaws_Error::IsError($users) && !empty($users)) {
foreach ($users as $user) {
if ($user['user'] != $uid) {
$combo->AddOption($user['nickname'] . ' (' . $user['username'] . ')', $user['user']);
}
}
}
$tpl->SetVariable('event_users', $combo->Get());
$tpl->SetVariable('lbl_event_users', _t('EVENTSCALENDAR_SHARED_FOR'));
// Actions
$tpl->SetVariable('lbl_ok', _t('GLOBAL_OK'));
$tpl->SetVariable('lbl_cancel', _t('GLOBAL_CANCEL'));
$tpl->SetVariable('url_back', $this->gadget->urlMap('ViewEvent', array('id' => $id)));
$tpl->ParseBlock('share');
return $tpl->Get();
}
开发者ID:juniortux,项目名称:jaws,代码行数:59,代码来源:ShareEvent.php
示例14: ShareNote
/**
* Builds sharing UI
*
* @access public
* @return string XHTML UI
*/
function ShareNote()
{
// Fetch note
$id = (int) jaws()->request->fetch('id', 'get');
$model = $this->gadget->model->load('Notepad');
$uid = (int) $GLOBALS['app']->Session->GetAttribute('user');
$note = $model->GetNote($id, $uid);
if (Jaws_Error::IsError($note) || empty($note) || $note['user'] != $uid) {
return;
}
$this->AjaxMe('site_script.js');
$tpl = $this->gadget->template->load('Share.html');
$tpl->SetBlock('share');
$tpl->SetVariable('id', $id);
$tpl->SetVariable('UID', $uid);
$tpl->SetVariable('note_title', $note['title']);
$tpl->SetVariable('title', _t('NOTEPAD_SHARE'));
$tpl->SetVariable('lbl_users', _t('NOTEPAD_USERS'));
$tpl->SetVariable('notepad_url', $this->gadget->urlMap('Notepad'));
// User groups
$uModel = new Jaws_User();
$groups = $uModel->GetGroups(true, 'title');
if (!Jaws_Error::IsError($groups)) {
$combo =& Piwi::CreateWidget('Combo', 'sys_groups');
$combo->AddEvent(ON_CHANGE, 'toggleUsers(this.value)');
$combo->AddOption(_t('NOTEPAD_ALL_USERS'), 0);
foreach ($groups as $group) {
$combo->AddOption($group['title'], $group['id']);
}
$tpl->SetVariable('groups', $combo->Get());
}
$tpl->SetVariable('lbl_groups', _t('NOTEPAD_GROUPS'));
// Note users
$model = $this->gadget->model->load('Share');
$combo =& Piwi::CreateWidget('Combo', 'note_users');
$combo->SetSize(10);
$users = $model->GetNoteUsers($id);
if (!Jaws_Error::IsError($users) && !empty($users)) {
foreach ($users as $user) {
if ($user['user_id'] != $uid) {
$combo->AddOption($user['nickname'] . ' (' . $user['username'] . ')', $user['user_id']);
}
}
}
$tpl->SetVariable('note_users', $combo->Get());
$tpl->SetVariable('lbl_note_users', _t('NOTEPAD_SHARED_FOR'));
// Actions
$tpl->SetVariable('lbl_ok', _t('GLOBAL_OK'));
$tpl->SetVariable('lbl_cancel', _t('GLOBAL_CANCEL'));
$tpl->SetVariable('url_back', $this->gadget->urlMap('Notepad'));
$tpl->ParseBlock('share');
return $tpl->Get();
}
开发者ID:juniortux,项目名称:jaws,代码行数:59,代码来源:Share.php
示例15: UploadPhotos
/**
* Displays a form for adding new images.
*
* @access public
* @return string XHTML template content
*/
function UploadPhotos()
{
$this->gadget->CheckPermission('AddPhotos');
$this->AjaxMe('script.js');
$album = jaws()->request->fetch('album', 'get');
$model = $this->gadget->model->load('Albums');
$tpl = $this->gadget->template->loadAdmin('UploadPhotos.html');
$tpl->SetBlock('upload');
$tpl->SetVariable('menubar', $this->MenuBar('UploadPhotos'));
include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php';
$phooFieldset = new Jaws_Widgets_FieldSet(_t('PHOO_UPLOAD_PHOTOS'));
$phooFieldset->SetDirection('vertical');
$phooFieldset->SetId('phoo_fieldset');
$phooForm =& Piwi::CreateWidget('Form', BASE_SCRIPT . '?gadget=Phoo', 'post', 'multipart/form-data');
$phooForm->Add(Piwi::CreateWidget('HiddenEntry', 'MAX_FILE_SIZE', '15000000'));
$phooForm->Add(Piwi::CreateWidget('HiddenEntry', 'gadget', 'Phoo'));
$phooForm->Add(Piwi::CreateWidget('HiddenEntry', 'action', 'UploadPhotosStep2'));
$albumcombo =& Piwi::CreateWidget('Combo', 'album', _t('PHOO_ALBUM'));
$albums = $model->GetAlbums('name', 'ASC');
if (!Jaws_Error::IsError($albums) && !empty($albums)) {
$date = Jaws_Date::getInstance();
foreach ($albums as $a) {
// FIXME: Ugly hack to add title to albumcombo
$o =& Piwi::CreateWidget('ComboOption', $a['id'], $a['name']);
$o->SetTitle(_t('PHOO_NUM_PHOTOS_ALBUM', $a['howmany']) . ' / ' . _t('PHOO_ALBUM_CREATION_DATE', $date->Format($a['createtime'])));
$albumcombo->_options[$a['id']] = $o;
}
}
$albumcombo->SetDefault((int) $album);
$phooFieldset->Add($albumcombo);
for ($i = 1; $i <= 5; $i++) {
$imageEntry =& Piwi::CreateWidget('FileEntry', 'photo' . $i);
$imageEntry->SetTitle(_t('PHOO_PHOTO') . ' ' . $i);
$phooFieldset->Add($imageEntry);
}
$addEntryButton =& Piwi::CreateWidget('Button', 'addEntryButton', _t('PHOO_ADD_ANOTHER_PHOTO'), STOCK_ADD);
$addEntryButton->AddEvent(ON_CLICK, "addEntry('" . _t('PHOO_PHOTO') . "');");
$addEntryUrl = '<span id="phoo_addentry6"><div><a href="#" onclick="addEntry(\'' . _t('PHOO_PHOTO') . '\');">' . _t('PHOO_ADD_ANOTHER_PHOTO') . '</a></div></span>';
$addEntryArea = '<span id="phoo_addentry6"><div>' . $addEntryButton->Get() . '</div></span>';
$addEntry =& Piwi::CreateWidget('StaticEntry', $addEntryArea);
$phooFieldset->Add($addEntry);
$buttonbox =& Piwi::CreateWidget('HBox');
$buttonbox->SetStyle(_t('GLOBAL_LANG_DIRECTION') == 'rtl' ? 'float: left;' : 'float: right;');
//hig style
$submit =& Piwi::CreateWidget('Button', 'uploadphotos', _t('PHOO_UPLOAD_PHOTOS'), STOCK_SAVE);
$submit->SetSubmit();
$buttonbox->Add($submit);
$phooForm->Add($phooFieldset);
$phooForm->Add($buttonbox);
$tpl->SetVariable('form', $phooForm->Get());
$tpl->ParseBlock('upload');
return $tpl->Get();
}
开发者ID:juniortux,项目名称:jaws,代码行数:59,代码来源:Upload.php
示例16: Aliases
/**
* Builds aliases UI
*
* @access public
* @return string XHTML template content
*/
function Aliases()
{
$this->AjaxMe('script.js');
$tpl = $this->gadget->template->loadAdmin('Aliases.html');
$tpl->SetBlock('Aliases');
$tpl->SetVariable('base_script', BASE_SCRIPT);
$form =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'post');
$form->Add(Piwi::CreateWidget('HiddenEntry', 'alias_id', '-'));
include_once JAWS_PATH . 'include/Jaws/Widgets/FieldSet.php';
$fieldset = new Jaws_Widgets_FieldSet(_t('URLMAPPER_ALIASES_ALIAS'));
$fieldset->SetDirection('vertical');
$fieldset->SetID('AliasFieldset');
$fieldset->SetStyle('width: 300px; min-width: 250px; max-width: 300px;');
$customUrl =& Piwi::CreateWidget('Entry', 'custom_url');
$customUrl->SetTitle(_t('URLMAPPER_ALIASES_LINK'));
$customUrl->SetId('custom_url');
$customUrl->SetStyle('width: 230px;');
$fieldset->Add($customUrl);
$alias =& Piwi::CreateWidget('Entry', 'alias', '', _t('URLMAPPER_ALIASES_ALIAS'));
$alias->SetId('alias');
$alias->SetStyle('width: 230px;');
$fieldset->Add($alias);
$hbox =& Piwi::CreateWidget('HBox');
$hbox->SetStyle(_t('GLOBAL_LANG_DIRECTION') == 'rtl' ? 'float: left;' : 'float: right;');
//hig style
$delete =& Piwi::CreateWidget('Button', 'delete', _t('GLOBAL_DELETE'), STOCK_DELETE);
$delete->AddEvent(ON_CLICK, 'deleteCurrentAlias();');
$delete->SetId('delete_button');
$delete->SetStyle('visibility: hidden;');
$hbox->Add($delete);
$cancel =& Piwi::CreateWidget('Button', 'cancel', _t('GLOBAL_CANCEL'), STOCK_CANCEL);
$cancel->AddEvent(ON_CLICK, 'stopAction();');
$cancel->SetId('cancel_button');
$hbox->Add($cancel);
$save =& Piwi::CreateWidget('Button', 'save', _t('GLOBAL_SAVE'), STOCK_SAVE);
$save->SetId('save_button');
$save->AddEvent(ON_CLICK, 'javascript:saveAlias();');
$hbox->Add($save);
$form->Add($fieldset);
$form->Add($hbox);
$tpl->SetVariable('edit_form', $form->Get());
$tpl->SetVariable('menubar', $this->MenuBar('Aliases'));
$model = $this->gadget->model->loadAdmin('Aliases');
$aliases = $model->GetAliases();
foreach ($aliases as $alias) {
$tpl->SetBlock('Aliases/alias');
$tpl->SetVariable('id', $alias['id']);
$tpl->SetVariable('alias_value', $alias['alias_url']);
$tpl->ParseBlock('Aliases/alias');
}
$tpl->ParseBlock('Aliases');
return $tpl->Get();
}
开发者ID:Dulciane,项目名称:jaws,代码行数:59,代码来源:Aliases.php
示例17: RegistryUI
/**
* Builds registry UI
*
* @access public
* @return string XHTML UI
*/
function RegistryUI()
{
$tpl = $this->gadget->template->loadAdmin('Registry.html');
$tpl->SetBlock('registry');
$button =& Piwi::CreateWidget('Button', '', _t('GLOBAL_SAVE'), STOCK_SAVE);
$button->AddEvent(ON_CLICK, 'javascript:saveRegistry();');
$tpl->SetVariable('save', $button->Get());
$button =& Piwi::CreateWidget('Button', '', _t('GLOBAL_RESET'), STOCK_REFRESH);
$button->AddEvent(ON_CLICK, 'componentRegistry(true);');
$tpl->SetVariable('reset', $button->Get());
$tpl->ParseBlock('registry');
return $tpl->Get();
}
开发者ID:Dulciane,项目名称:jaws,代码行数:19,代码来源:Registry.php
示例18: Account
/**
* Builds a simple form to update user account info(nickname, email, password)
*
* @access public
* @return string XHTML form
*/
function Account()
{
if (!$GLOBALS['app']->Session->Logged()) {
Jaws_Header::Location($this->gadget->urlMap('LoginBox', array('referrer' => bin2hex(Jaws_Utils::getRequestURL(true)))));
}
$this->gadget->CheckPermission('EditUserName,EditUserNickname,EditUserEmail,EditUserPassword', '', false);
$response = $GLOBALS['app']->Session->PopResponse('Users.Account.Response');
if (!isset($response['data'])) {
$jUser = new Jaws_User();
$account = $jUser->GetUser($GLOBALS['app']->Session->GetAttribute('user'), true, true);
} else {
$account = $response['data'];
}
// Menubar
$account['menubar'] = $this->MenuBar('Account');
$account['submenubar'] = $this->SubMenuBar('Account', array('Account', 'Personal', 'Preferences', 'Contacts'));
$account['title'] = _t('USERS_ACCOUNT_INFO');
$account['update'] = _t('USERS_USERS_ACCOUNT_UPDATE');
$account['lbl_username'] = _t('USERS_USERS_USERNAME');
$account['lbl_nickname'] = _t('USERS_USERS_NICKNAME');
$account['lbl_email'] = _t('GLOBAL_EMAIL');
$account['lbl_password'] = _t('USERS_USERS_PASSWORD');
$account['emptypassword'] = _t('USERS_NOCHANGE_PASSWORD');
$account['lbl_chkpassword'] = _t('USERS_USERS_PASSWORD_VERIFY');
if (!$this->gadget->GetPermission('EditUserName')) {
$account['username_disabled'] = 'disabled="disabled"';
}
if (!$this->gadget->GetPermission('EditUserNickname')) {
$account['nickname_disabled'] = 'disabled="disabled"';
}
if (!$this->gadget->GetPermission('EditUserEmail')) {
$account['email_disabled'] = 'disabled="disabled"';
}
if (!$this-
|
请发表评论