本文整理汇总了PHP中Am_Form_Setup::initElements方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Form_Setup::initElements方法的具体用法?PHP Am_Form_Setup::initElements怎么用?PHP Am_Form_Setup::initElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_Form_Setup
的用法示例。
在下文中一共展示了Am_Form_Setup::initElements方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initElements
public function initElements()
{
parent::initElements();
if (method_exists($this->plugin, "parseExternalConfig") && !$this->plugin->isConfigured()) {
$this->addFolderSelect();
}
$this->addOtherDb();
$this->addDbPrefix();
$this->addGroupSettings();
$this->addFieldsPrefix("protect.{$this->pageId}.");
$this->addScript('script')->setScript($this->getJs());
if ($this->plugin->canAutoCreate()) {
$this->addAdvCheckbox('auto_create')->setLabel(___("Create aMember Users By Demand\n" . "silently create customer in aMember if\n" . "user tries to login into aMember with\n" . "the same username and password as for %s", $this->getTitle()));
}
if (defined($const = get_class($this->plugin) . "::PLUGIN_STATUS") && (constant($const) == Am_Plugin::STATUS_BETA || constant($const) == Am_Plugin::STATUS_DEV)) {
$beta = constant($const) == Am_Plugin::STATUS_DEV ? 'ALPHA' : 'BETA';
$this->addProlog("<div class='warning_box'>This plugin is currently in {$beta} testing stage, some functions may work unstable." . "Please test it carefully before use.</div>");
}
$this->plugin->afterAddConfigItems($this);
}
示例2: initElements
public function initElements()
{
parent::initElements();
if (method_exists($this->plugin, "parseExternalConfig") && !$this->plugin->isConfigured()) {
$this->addFolderSelect();
}
$this->addOtherDb();
$this->addDbPrefix();
$this->addGroupSettings();
if ($this->plugin->canAutoCreate() && $this->plugin->isConfigured()) {
$gr = $this->addGroup()->setLabel(___("Create aMember Users By Demand\n" . "silently create customer in aMember if\n" . "user tries to login into aMember with\n" . "the same username and password as for %s", $this->getTitle()));
$el = $gr->addAdvCheckbox('auto_create');
$auto_create_id = $el->getId();
$options = array('' => ___('Please Select'));
if ($this->plugin->canAutoCreateFromGroups()) {
$options['-1'] = ___('Add Access depends on current user\'s groups in ' . $this->plugin->getTitle());
}
foreach (Am_Di::getInstance()->billingPlanTable->selectAllSorted() as $p) {
try {
$k = $p->product_id . '_' . $p->plan_id;
$v = $p->getProduct()->title;
$v .= ' (' . $p->getTerms() . ')';
$options[$k] = $v;
} catch (Exception $e) {
}
}
$el = $gr->addSelect("auto_create_billing_plan")->setLabel(___("Default Level\n" . "users created by demand\n" . "will have access to the sele\n" . "(for example all subscriptions expired)"))->loadOptions($options);
$auto_create_billing_plan_id = $el->getId();
$el = $gr->addStatic("auto_create_billing_plan_text")->setContent('<span id=auto_create_billing_plan_text-0><br/>' . ___('please select billing plan to add manual access to users added by demand') . '</span>');
$auto_create_billing_plan_text_id = $el->getId();
if ($this->plugin->canAutoCreateFromGroups()) {
//$group_plans = $gr->addGroup('auto_create_bpgroups');
$group_plans = $gr;
unset($options['-1']);
$group_plans->addStatic()->setContent('<div id="auto_create_billing_plan_products">');
try {
foreach ($this->plugin->getAvailableUserGroups() as $g) {
$group_plans->addStatic()->setContent('<div class="acbp_left">' . $g->getTitle() . '</div><div class="acbp_right">');
$group_plans->addElement('select', "auto_create_bpgroups_" . $g->getId())->loadOptions($options);
$group_plans->addStatic()->setContent('</div><br/>');
}
} catch (Am_Exception_Db $e) {
// to avoid errors while db is not yet configured
}
$group_plans->addStatic()->setContent('</div>');
}
$this->addScript('script_auto_create')->setScript(<<<CUT
\$(function(){
\$('#{$auto_create_id}').change(function(){
\$('#{$auto_create_billing_plan_id},#{$auto_create_billing_plan_text_id}').toggle(this.checked);
\$('#auto_create_billing_plan_products').toggle(\$('#{$auto_create_billing_plan_id}').val()=='-1' && this.checked);
}).change();
\$('#{$auto_create_billing_plan_id}').change(function(){
\$('#auto_create_billing_plan_products').toggle(\$('#{$auto_create_billing_plan_id}').val()=='-1' && \$('#{$auto_create_id}').is(':checked'));
}).change();
})
CUT
);
}
$this->addFieldsPrefix("protect.{$this->pageId}.");
$this->addScript('script')->setScript($this->getJs());
if (defined($const = get_class($this->plugin) . "::PLUGIN_STATUS") && (constant($const) == Am_Plugin::STATUS_BETA || constant($const) == Am_Plugin::STATUS_DEV)) {
$beta = constant($const) == Am_Plugin::STATUS_DEV ? 'ALPHA' : 'BETA';
$this->addProlog("<div class='warning_box'>This plugin is currently in {$beta} testing stage, some functions may work unstable." . "Please test it carefully before use.</div>");
}
$this->plugin->afterAddConfigItems($this);
}