本文整理汇总了PHP中I2CE_FormFactory类的典型用法代码示例。如果您正苦于以下问题:PHP I2CE_FormFactory类的具体用法?PHP I2CE_FormFactory怎么用?PHP I2CE_FormFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了I2CE_FormFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action
/**
* Perform the main actions of the page.
*/
public function action()
{
parent::action();
$factory = I2CE_FormFactory::instance();
$this->template->setAttribute("class", "active", "menuDashboard", "a[@href='dashboard']");
$this->template->appendFileById("menu_dashboard.html", "ul", "menuDashboard");
}
示例2: loadObjects
protected function loadObjects()
{
$factory = I2CE_FormFactory::instance();
if ($this->isPost()) {
$dataelement = $factory->createContainer('dataelement');
if (!$dataelement instanceof iHRIS_DataElement) {
I2CE::raiseError("Could not create Data Element form");
return;
}
$dataelement->load($this->post);
} else {
if ($this->get_exists('id')) {
$id = $this->get('id');
if (strpos($id, '|') === false) {
I2CE::raiseError("Depcreated use of id variable");
$id = 'dataelement|' . $id;
}
} else {
$id = 'dataelement|0';
}
$dataelement = $factory->createContainer($id);
if (!$dataelement instanceof iHRIS_DataElement) {
I2CE::raiseError("Could not create valid Data Element form from id:{$id}");
return;
}
$dataelement->populate();
$dataelement->load($this->request());
}
$this->setObject($dataelement);
}
示例3: action
/**
* Perform the actions of this page.
* @return boolean
*/
protected function action()
{
if (parent::action()) {
$next_month = getdate(mktime(0, 0, 0, $this->month + 1, 1, $this->year));
$db_start = sprintf('%04d-%02d-%02d', $this->year, $this->month, 1);
$db_end = sprintf('%04d-%02d-%02d', $next_month['year'], $next_month['mon'], $next_month['mday']);
$find_instances = array('operator' => 'OR', 'operand' => array(0 => array('operator' => 'AND', 'operand' => array(0 => array('operator' => 'FIELD_LIMIT', 'style' => 'greaterthan_equals', 'field' => 'start_date', 'data' => array('value' => $db_start)), 1 => array('operator' => 'FIELD_LIMIT', 'style' => 'lessthan', 'field' => 'start_date', 'data' => array('value' => $db_end)))), 1 => array('operator' => 'AND', 'operand' => array(0 => array('operator' => 'FIELD_LIMIT', 'style' => 'greaterthan_equals', 'field' => 'end_date', 'data' => array('value' => $db_start)), 1 => array('operator' => 'FIELD_LIMIT', 'style' => 'lessthan', 'field' => 'end_date', 'data' => array('value' => $db_end))))));
$instances = I2CE_FormStorage::search("scheduled_training_course", false, $find_instances);
$factory = I2CE_FormFactory::instance();
$month_end = new DateTime($db_end);
$deviation = 35;
$base = array(70, 116, 149);
foreach ($instances as $instance) {
$rgb = array();
foreach ($base as $idx => $num) {
$rgb[$idx] = rand($num - $deviation, $num + $deviation);
}
$inst = $factory->createContainer("scheduled_training_course|{$instance}");
$inst->populate();
$this->addForm($inst, $inst->start_date->getDateTimeObj(), $inst->end_date->getDateTimeObj(), 'calendar_training_course_day.html', $rgb);
}
} else {
return false;
}
return true;
}
示例4: __construct
/**
* Create a new instance of a page.
*
* The default constructor should be called by any pages extending this object. It creates the
* {@link I2CE_Template} and {@link I2CE_User} objects and sets up the basic member variables.
* @param array $args
* @param array $request_remainder The remainder of the request path
*/
public function __construct($args, $request_remainder, $get = null, $post = null)
{
parent::__construct($args, $request_remainder, $get, $post);
$this->form_factory = I2CE_FormFactory::instance();
$this->check_map = I2CE_ModuleFactory::instance()->isEnabled("Lists");
$this->locale = I2CE_Locales::DEFAULT_LOCALE;
}
示例5: action
/**
* Perform the main actions of the page.
* @return boolean
*/
protected function action()
{
if (!parent::action()) {
return false;
}
if (!$this->hasPermission("task(person_can_edit_child_form_person_instance)")) {
$this->userMessage("You do not have permission to edit participants for this instance.");
return false;
}
if (!$this->get_exists('person') || !$this->get_exists('instance')) {
$this->template->addFile('action_participants_error.html');
return true;
}
$person_instance = $this->getPersonInstance($this->get('person'), $this->get('instance'));
$piObj = I2CE_FormFactory::instance()->createContainer("person_instance|" . $person_instance);
if ($person_instance) {
$piObj->populate();
if ($piObj->attending == 0) {
$piObj->attending = 1;
$this->template->addFile("action_participants_add.html");
} else {
$piObj->attending = 0;
$this->template->addFile("action_participants_remove.html");
}
} else {
$piObj->setParent($this->get('person'));
$piObj->getField('provider_instance')->setFromDB($this->get('instance'));
$piObj->getField('attending')->setFromDB(1);
$this->template->addFile("action_participants_add.html");
}
return $piObj->save($this->user);
}
示例6: loadObjects
protected function loadObjects()
{
if (!$this->hasPermission("task(can_schedule_students_course_enrollment)") or $this->getUser()->role == "admin") {
$this->setRedirect("noaccess");
}
$factory = I2CE_FormFactory::instance();
$username = $this->getUser()->username;
$training_institution = IHS_PageFormLecturer::fetch_institution($username);
$where = array("operator" => "FIELD_LIMIT", "field" => "training_institution", "style" => "equals", "data" => array("value" => $training_institution));
$fields = I2CE_FormStorage::search("schedule_course_enrollment", false, $where);
foreach ($fields as $id) {
//do nothing
}
if ($id) {
$form = "schedule_course_enrollment|" . $id;
} else {
$form = "schedule_course_enrollment";
}
$courseEnrObj = $factory->createContainer($form);
$courseEnrObj->populate();
if ($this->isPost()) {
$courseEnrObj->load($this->post);
}
$courseEnrObj->getField("training_institution")->setFromDB($training_institution);
$this->setObject($courseEnrObj);
}
示例7: ensureLimits
protected function ensureLimits()
{
if ($this->ensured) {
return;
}
if ($this->storage->is_scalar()) {
return false;
}
if (!$this->parent instanceof I2CE_Swiss_CustomReports_Report_ReportingForm_Field) {
return false;
}
$factory = I2CE_FormFactory::instance();
$formName = $this->parent->getForm();
$formObj = $factory->createForm($formName);
if (!$formObj instanceof I2CE_Form) {
I2CE::raiseError("Could not instantiate the form {$formName} at " . $this->configPath);
return false;
}
$field = $this->parent->getName();
$allowed_limits = $formObj->getLimitStyles($field);
$excludes = I2CE::getConfig()->getAsArray("/modules/CustomReports/limit_excludes/displayed");
foreach ($allowed_limits as $limit => $data) {
if (in_array($limit, $excludes)) {
continue;
}
$swissLimit = $this->getChild($limit, true);
if (is_array($data) && count($data) == 1 && in_array('value', $data)) {
$swissLimit->setAllowPivot(true);
} else {
$swissLimit->setAllowPivot(false);
}
}
$this->ensured = true;
}
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:34,代码来源:I2CE_Swiss_CustomReports_Report_ReportingForm_Field_Limits.php
示例8: loadObjects
/**
* Create and load data for the objects used for this form.
*
* Create the list object and if this is a form submission load
* the data from the form data.
*/
protected function loadObjects()
{
$factory = I2CE_FormFactory::instance();
if ($this->isPost()) {
$trainingprovider = $factory->createContainer('trainingprovider');
if (!$trainingprovider instanceof iHRIS_TrainingProvider) {
I2CE::raiseError("Could not create trainingprovider form");
return;
}
$trainingprovider->load($this->post);
$name_ignore = $trainingprovider->getField('name_ignore');
$ignore_path = array('forms', 'trainingprovider', $trainingprovider->getID(), 'ignore', 'name');
if ($name_ignore instanceof I2CE_FormField && $this->post_exists($ignore_path)) {
$name_ignore->setFromPost($this->post($ignore_path));
}
} else {
if ($this->get_exists('id')) {
$id = $this->get('id');
if (strpos($id, '|') === false) {
I2CE::raiseError("Depcreated use of id variable");
$id = 'trainingprovider|' . $id;
}
} else {
$id = 'trainingprovider|0';
}
$trainingprovider = $factory->createContainer($id);
if (!$trainingprovider instanceof iHRIS_TrainingProvider) {
I2CE::raiseError("Could not create valid trainingprovider form from id:{$id}");
return;
}
$trainingprovider->populate();
}
$this->setObject($trainingprovider);
}
示例9: noData
protected function noData($contentNode)
{
if (!($noDataNode = $this->template->appendFileByNode("customReports_notfound.html", 'div', $contentNode)) instanceof DOMNode) {
return;
}
$link = '';
if (!$this->config->setIfIsSet($link, 'create_link') || !$link) {
return;
}
$createNode = $this->template->addFile("customReports_notfound_create.html", 'div', $noDataNode);
if (!$createNode instanceof DOMNode) {
return;
}
if (!($linkNode = $this->template->getElementByName('create_form_link', 0)) instanceof DOMNode) {
return;
}
$this->template->addHeaderLink('create_from_limits.js');
$rel = $this->reportObj->getFormRelationship();
$form = $rel->getPrimaryForm();
if (!($formObj = I2CE_FormFactory::instance()->createContainer($form)) instanceof I2CE_Form) {
return;
}
$form_name = $formObj->getDisplayName();
$js = 'createFormFromSearch(this,"' . $form . '");';
$linkNode->setAttribute('onClick', $js);
$this->template->setDisplayData('has_create_data', 1, $createNode);
$this->template->setDisplayData('create_form_link', $link, $createNode);
$this->template->setDisplayData('create_form_name', $form_name, $createNode);
}
示例10: action
/**
* Perform the main actions of the page.
*/
protected function action()
{
$factory = I2CE_FormFactory::instance();
$this->template->setAttribute("class", "active", "menuConfigure", "a[@href='configure']");
$this->template->appendFileById("menu_configure.html", "ul", "menuConfigure");
parent::action();
}
示例11: loadObjects
/**
* Create and load data for the objects used for this form.
*
* Create the list object and if this is a form submission load
* the data from the form data.
*/
protected function loadObjects()
{
$factory = I2CE_FormFactory::instance();
if ($this->isPost()) {
$person = $factory->createContainer('person');
if (!$person instanceof iHRIS_Person) {
I2CE::raiseError("Could not create person form");
return;
}
$person->load($this->post);
$surname_ignore = $person->getField('surname_ignore');
$ignore_path = array('forms', 'person', $person->getID(), 'ignore', 'surname');
if ($surname_ignore instanceof I2CE_FormField && $this->post_exists($ignore_path)) {
$surname_ignore->setFromPost($this->post($ignore_path));
}
} else {
if ($this->get_exists('id')) {
$id = $this->get('id');
if (strpos($id, '|') === false) {
I2CE::raiseError("Depcreated use of id variable");
$id = 'person|' . $id;
}
} else {
$id = 'person|0';
}
$person = $factory->createContainer($id);
if (!$person instanceof iHRIS_Person) {
I2CE::raiseError("Could not create valid person form from id:{$id}");
return;
}
$person->populate();
$person->load($this->request());
}
$this->setObject($person, I2CE_PageForm::EDIT_PRIMARY, null, true);
}
示例12: action
protected function action()
{
if (!parent::action()) {
return false;
}
I2CE::raiseError("aremaC <- sthgiL");
if (!is_scalar($search_form = array_shift($this->request_remainder)) || !($search_obj = I2CE_FormFactory::instance()->createContainer($search_form)) instanceof CSD_SearchMatches || (!($matches = $search_obj->getField('matches'))) instanceof I2CE_FormField_ASSOC_MAP_RESULTS) {
return false;
}
I2CE::raiseError(print_r($this->request(), true));
if (($maxField = $search_obj->getField('max')) instanceof I2CE_FormField_INT) {
if ($maxField->getValue() > 200) {
$maxField->setValue(200);
}
}
$search_obj->load($this->post, false, false);
I2CE::raiseError($search_obj->getXMLRepresentation(false));
$search_obj->setID("1");
//so it will populate
$search_obj->populate(true);
if (count($results = $matches->getValue()) > 200) {
return false;
I2CE::raiseError("Too many results");
}
$this->data['length'] = count($results);
$this->data['data'] = $results;
I2CE::raiseError("REQ=" . print_r($this->request(), true));
$this->data = array($this->data);
I2CE::raiseError(print_r($this->data, true));
return true;
}
示例13: loadPrimaryObject
/**
* Set up the main object for this page as well as the training provider.
*/
protected function loadPrimaryObject()
{
$this->factory = I2CE_FormFactory::instance();
if (!$this->request_exists('id')) {
$this->userMessage("Invalid Training Provider Requested");
return false;
}
if ($this->request_exists('id')) {
$id = $this->request('id');
if (strpos($id, '|') === false) {
I2CE::raiseError("Deprecated use of id variable");
$id = 'trainingprovider|' . $id;
}
} else {
$id = 'trainingprovider|0';
}
$this->mainObj = $this->factory->createContainer($id);
$this->mainObj->populate();
if (!$this->mainObj instanceof iHRIS_TrainingProvider && $this->mainObj->getParentID() != 0) {
$provider = $this->factory->createContainer($this->mainObj->getParent());
$provider->populate();
$this->template->setForm($provider);
}
$this->template->setForm($this->mainObj);
}
示例14: validate_form_reschedule_course
public function validate_form_reschedule_course($form)
{
$semester = implode("|", $form->new_semester);
$course = implode("|", $form->training);
$academic_year = implode("|", $form->academic_year);
$username = $this->getUser()->username;
$training_institution = iHRIS_PageFormLecturer::fetch_institution($username);
$where = array("operator" => "AND", "operand" => array(0 => array("operator" => "FIELD_LIMIT", "field" => "academic_year", "style" => "equals", "data" => array("value" => $academic_year)), 1 => array("operator" => "FIELD_LIMIT", "field" => "training", "style" => "equals", "data" => array("value" => $course)), 2 => array("operator" => "FIELD_LIMIT", "field" => "training_institution", "style" => "equals", "data" => array("value" => $training_institution))));
$is_rescheduled = I2CE_FormStorage::search("reschedule_course", false, $where);
if (count($is_rescheduled) > 0) {
$form->setInvalidMessage("training", "This Course Already Rescheduled For This Semester In This Academic Year");
}
$ff = I2CE_FormFactory::instance();
if (!($courseObj = $ff->createContainer($course)) instanceof iHRIS_Training) {
return;
}
$courseObj->populate();
$crs_semester = $courseObj->getField("semester")->getDBValue();
if ($crs_semester == $semester) {
$form->setInvalidMessage("new_semester", "This Course Is Currently Offered In This Semester");
return;
}
$sem = $form->new_semester[1];
$crs_semester = explode("|", $crs_semester);
$crs_semester = $crs_semester[1];
if ($crs_semester > $sem or $sem - $crs_semester != 1) {
$form->setInvalidMessage("new_semester", "A Course Must Be Rescheduled To A Next Semester");
}
}
示例15: action
/**
* Handle the actions for the page.
* @return boolean
*/
protected function action()
{
if (!$this->get_exists('id')) {
$this->template->addFile("user_alerts_acknowledge_invalid.html");
return true;
} else {
$user_alert = I2CE_FormFactory::instance()->createContainer($this->get('id'));
if (!$user_alert instanceof iHRIS_UserAlert) {
$this->template->addFile("user_alerts_acknowledge_invalid.html");
return true;
}
$user_alert->populate();
$user = $this->getUser();
if (!$user_alert->getParentId()) {
$this->template->addFile("user_alerts_acknowledge_invalid.html");
return true;
}
if ($user_alert->getParentId() != $user->username && !$this->hasPermission("task(user_alerts_edit_all)")) {
$this->template->addFile("user_alerts_acknowledge_perms.html");
return true;
}
if ($user_alert->time_ack->equals(I2CE_Date::blank())) {
$user_alert->time_ack = I2CE_Date::now();
$user_alert->save($user);
}
if (array_key_exists('HTTP_REFERER', $_SERVER)) {
$this->setRedirect($_SERVER['HTTP_REFERER']);
} else {
$this->setRedirect("view_alerts");
}
}
return true;
}