本文整理匯總了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);
}