本文整理汇总了PHP中Controller::_new方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::_new方法的具体用法?PHP Controller::_new怎么用?PHP Controller::_new使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller
的用法示例。
在下文中一共展示了Controller::_new方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _new
public function _new()
{
parent::_new();
// work_order_id is set for adding a new structure
// otherwise id is set, which is the id of the structure element
$uom_list = array();
$wostructure = $this->_uses[$this->modeltype];
if (isset($this->_data['work_order_id'])) {
$work_order_id = $this->_data['work_order_id'];
$stitem_id = key($items_list);
$uom_id = '';
} elseif ($wostructure->isLoaded()) {
$work_order_id = $wostructure->work_order_id;
$stitem_id = $wostructure->ststructure_id;
$uom_id = $wostructure->uom_id;
}
if (isset($this->_data['ststructure_id'])) {
$stitem_id = $this->_data['ststructure_id'];
}
$stitem = new STItem();
$stitem->load($stitem_id);
$items_list = STItem::nonObsoleteItems();
if (!isset($items_list[$stitem_id])) {
$items_list += array($stitem->id => $stitem->getIdentifierValue() . '(Obsolete)');
}
$this->view->set('ststructures', $items_list);
$uom_id = empty($uom_id) ? $stitem->uom_id : $uom_id;
$this->view->set('uom_id', $uom_id);
$uom_list = $stitem->getUomList();
if (isset($work_order_id)) {
$this->view->set('elements', self::showParts($work_order_id));
$this->view->set('no_ordering', true);
}
$this->view->set('uom_list', $uom_list);
}
示例2: _new
public function _new()
{
parent::_new();
$resource = $this->_uses[$this->modeltype];
$db = DB::Instance();
if ($resource->isLoaded()) {
$this->_data['work_schedule_id'] = $resource->work_schedule_id;
$this->view->set('workschedule', $resource->work_schedule_detail);
} elseif (isset($this->_data['work_schedule_id'])) {
$resource->work_schedule_id = $this->_data['work_schedule_id'];
$this->view->set('workschedule', $resource->work_schedule_detail);
} else {
$workschedule = DataObjectFactory::Factory('WorkSchedule');
$cc = new ConstraintChain();
$cc->add(new Constraint('status', '!=', $workschedule->completedStatus()));
$cc->add(new Constraint('status', '!=', $workschedule->cancelledStatus()));
$this->view->set('workschedules', $workschedule->getAll($cc));
}
$person = DataObjectFactory::Factory('Person');
$cc = new ConstraintChain();
$cc->add(new Constraint('company_id', '=', COMPANY_ID));
$this->view->set('people', $person->getAll($cc));
$resources = new EngineeringResourceCollection($this->_templateobject);
$sh = $this->setSearchHandler($resources);
$sh->addConstraint(new Constraint('work_schedule_id', '=', $resource->work_schedule_id));
parent::index($resources, $sh);
$this->view->set('clickaction', 'edit');
}
示例3: _new
public function _new()
{
parent::_new();
// For new actions the stitem_id and from_uom_id will be set
// For edit actions, the id will be set pointing to the uom conversion to be edited
if ($this->_data['action'] == 'edit') {
$stuom = $this->_uses[$this->modeltype];
$stitem_id = $stuom->stitem_id;
$stitem_uom_id = $stuom->from_uom_id;
$stitem_uom_name = $stuom->from_uom_name;
} else {
$stitem = new STitem();
$stitem->load($this->_data['stitem_id']);
$stitem_id = $stitem->id;
$stitem_uom_id = $stitem->uom_id;
$stitem_uom_name = $stitem->uom_name;
}
$this->view->set('stitem_id', $stitem_id);
$this->view->set('stitem_uom_id', $stitem_uom_id);
$this->view->set('stitem_uom_name', $stitem_uom_name);
$this->view->set('stitem', Stuomconversion::getStockItem($stitem_id));
$elements = new STuomconversionCollection(new STuomconversion());
$sh = new SearchHandler($elements, false);
$sh->extract();
$sh->addConstraint(new Constraint('stitem_id', '=', $stitem_id));
$sh->setOrderBy('from_uom_name');
$sh->extractOrdering();
$sh->extractPaging();
$elements->load($sh);
$this->view->set('elements', $elements);
$this->view->set('no_ordering', true);
}
示例4: _new
public function _new()
{
$flash = Flash::Instance();
// ensure that a project id is specified for new notes
if ($this->_data['action'] === 'new' && (!isset($this->_data['project_id']) || empty($this->_data['project_id']))) {
$flash->addError('No project id specified');
sendBack();
}
parent::_new();
// load either a new project or the current note model to get the project name and id
if ($this->_data['action'] === 'new') {
$project = new Project();
$project->load($this->_data['project_id']);
$project_name = $project->name;
$project_id = $project->id;
} else {
$model = $this->_uses[$this->modeltype];
$project_name = $model->project;
$project_id = $model->project_id;
}
$sidebar = new SidebarController($this->view);
$sidebar->addList('Project', array('view_project' => array('tag' => $project_name, 'link' => array('module' => 'projects', 'controller' => 'projects', 'action' => 'view', 'id' => $project_id))));
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例5: _new
public function _new()
{
parent::_new();
$this->setTemplateName('calls_new');
$projects = $opportunities = $activities = null;
if (isset($this->_data['person_id'])) {
$person = new Person();
$person->load($this->_data['person_id']);
$this->_data['company_id'] = $person->company_id;
$projects = $person->projects;
$opportunities = $person->opportunities;
$activities = $person->activities;
$this->view->set('person', $person->fullname);
}
if (isset($this->_data['company_id'])) {
$company = new Company();
$company->load($this->_data['company_id']);
$projects = DataObjectCollection::Merge($company->projects, $projects);
$opportunities = DataObjectCollection::Merge($company->opportunities, $opportunities);
$activities = DataObjectCollection::Merge($company->activities, $activities);
$this->view->set('company', $company->name);
}
if (isset($this->_data['project_id'])) {
$project = new Project();
$project->load($this->_data['project_id']);
$this->_data['company_id'] = $project->company_id;
}
$this->view->set('projects', $projects);
$this->view->set('opportunities', $opportunities);
$this->view->set('activities', $activities);
}
示例6: _new
public function _new()
{
parent::_new();
$role = $this->_uses['Role'];
$users = DataObjectFactory::Factory('User');
$this->view->set('users', $users->getActive());
$companypermissions = DataObjectFactory::Factory('Companypermission');
$modulepermissions = $companypermissions->getAll();
// Note: If no company permissions have been defined ($modulepermissions is empty)
// then all permissions will be displayed; i.e. default is to allow access to
// all permissions if no company permissions override
$permissions = new PermissionCollection(DataObjectFactory::Factory('Permission'));
$this->view->set('items', $permissions->getPermissionTree($modulepermissions));
$this->view->set('permissions_tree', $this->getTemplateName('permissions_tree'));
$sidebar = new SidebarController($this->view);
$sidebar->addList('Actions', array('viewall' => array('link' => array('modules' => $this->_modules, 'controller' => $this->name), 'tag' => 'View All Roles')));
if ($role->isLoaded()) {
$hasrole = DataObjectFactory::Factory('hasRole');
$this->view->set('current_users', $hasrole->getUsers($role->{$role->idField}));
$this->view->set('current', $role->getPermissions());
$sidebar->addList('Actions', array('View' => array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'view', 'id' => $role->{$role->idField}), 'tag' => 'View "' . $role->getIdentifierValue() . '" role"')));
} else {
$this->view->set('current', array());
}
$this->view->register('sidebar', $sidebar);
$this->view->set('clickaction', 'view');
$this->view->set('sidebar', $sidebar);
}
示例7: _new
public function _new()
{
parent::_new();
$permissions = new PermissionCollection(new Permission());
$sh = new SearchHandler($permissions, FALSE);
$sh->addConstraint(new Constraint('parent_id', 'is', 'NULL'));
$sh->setOrderby('title');
$permissions->load($sh);
$systemcompany = $this->_uses[$this->modeltype];
if ($systemcompany->isLoaded()) {
$companypermissions = new CompanypermissionCollection(new Companypermission());
$checked = $companypermissions->getPermissionIDs($systemcompany->id);
$this->view->set('checked', $checked);
$debug = DebugOption::getCompanyOption($systemcompany->id);
$this->view->set('debug_id', $debug->id);
$this->view->set('selected_options', $debug->getOptions());
foreach ($permissions as $permission) {
$permission->setAdditional('permissions');
if (isset($checked[$permission->id])) {
$permission->permissions = TRUE;
} else {
$permission->permissions = FALSE;
}
}
}
$this->view->set('permissions', $permissions);
$debug = new DebugOption();
$this->view->set('debug_options', $debug->getEnumOptions('options'));
}
示例8: _new
public function _new()
{
$resource = $this->_uses[$this->modeltype];
if (!$resource->isLoaded()) {
if (empty($this->_data['project_id'])) {
$project = new Project();
$projects = $project->getAll();
$project_id = key($projects);
} else {
$project_id = $this->_data['project_id'];
}
$this->view->set('project_id', $project_id);
$tasks = $this->getTaskList($project_id);
$dates = $this->getStartEndDate($project_id);
$this->view->set('start_date', $dates['start_date']['data']);
$this->view->set('end_date', $dates['end_date']['data']);
} else {
$tasks = $this->getTaskList($resource->project_id);
}
$this->view->set('tasks', $tasks);
$person = new Person();
$cc = new ConstraintChain();
$cc->add(new Constraint('company_id', '=', COMPANY_ID));
$this->view->set('people', $person->getAll($cc));
parent::_new();
}
示例9: _new
public function _new()
{
parent::_new();
$policypermission = $this->_uses[$this->modeltype];
if ($policypermission->isLoaded()) {
$this->_data['object_policies_id'] = $policypermission->object_policies_id;
}
}
示例10: _new
public function _new()
{
parent::_new();
$sidebar = new SidebarController($this->view);
$sidebar->addList('Actions', array('new' => array('link' => array('module' => $this->_modules['module'], 'controller' => $this->name, 'action' => 'index'), 'tag' => 'Return to Supplementary Complaint Codes')));
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例11: _new
public function _new()
{
// Set title when showing form after customer account stopped
if ($this->_data['title'] == 'Account stopped') {
$this->view->set('page_title', 'Enter reason for stopping account');
}
parent::_new();
}
示例12: _new
public function _new()
{
$flash = Flash::Instance();
// Get the Action
$whaction = new WHAction();
$whactions = $whaction->getActions('T');
$this->view->set('transfer_actions', $whactions);
// Display the New/Edit screen
parent::_new();
}
示例13: _new
public function _new()
{
parent::_new();
$access_list = $this->_uses[$this->modeltype];
$access_types = $access_list->getEnumOptions('access_type');
if (!$access_list->isLoaded()) {
$access_list->access_type = key($access_types);
}
$this->view->set('access_types', $access_types);
$this->view->set('options', $this->get_values($access_list->access_type));
}
示例14: _new
public function _new()
{
if (ismoduleadmin()) {
$employee = DataObjectFactory::Factory('Employee');
$employee->load($this->_data['employee_id']);
$this->view->set('employee', $employee);
parent::_new();
} else {
$flash = Flash::Instance();
$flash->addError('You do not have permission to add a Holiday Extra Day!');
sendTo();
}
}
示例15: _new
public function _new()
{
parent::_new();
$projectequipmentallocation = $this->_uses[$this->modeltype];
$equipmentlist = $this->getOptions($this->_templateobject, 'project_equipment_id', 'getOptions', 'getOptions');
$data = isset($this->_data[$this->modeltype]) ? $this->_data[$this->modeltype] : array();
if (!empty($this->_data['project_id'])) {
$data['project_id'] = $this->_data['project_id'];
}
if (!empty($this->_data['task_id'])) {
$data['task_id'] = $this->_data['task_id'];
}
if (!empty($data['project_equipment_id'])) {
// this is set if there has been error and we are redisplaying the screen
$default_equipment = $this->_data['project_equipment_id'];
} else {
if (!$projectequipmentallocation->isLoaded()) {
$default_equipment = $this->getDefaultValue($this->modeltype, 'project_equipment_id', '');
} else {
$default_equipment = $projectequipmentallocation->project_equipment_id;
}
}
if (empty($default_equipment)) {
$default_equipment = key($equipmentlist);
}
$projectequipment = $this->getEquipmentDetail($default_equipment);
$this->view->set('setup_charge', $projectequipment->setup_cost);
$this->view->set('charge_rate', $projectequipment->hourly_cost);
$project_id = !empty($this->_data['project_id']) ? $this->_data['project_id'] : '';
$task_id = !empty($this->_data['task_id']) ? $this->_data['task_id'] : '';
if (!$projectequipmentallocation->isLoaded()) {
$projectequipmentallocation->project_equipment_id = $default_equipment;
if (!empty($data['task_id']) && empty($data['project_id'])) {
$task = new Task();
$task->load($data['task_id']);
if ($task->isLoaded()) {
$data['project_id'] = $projectequipmentallocation->project_id = $task->project_id;
}
}
$projectequipmentallocation->project_id = $data['project_id'];
$dates = $this->getStartEndDate($data['project_id'], $data['task_id']);
$this->view->set('start_date', $dates['start_date']);
$this->view->set('end_date', $dates['end_date']);
} else {
$dates['start_date'] = un_fix_date($projectequipmentallocation->start_date);
$dates['end_date'] = un_fix_date($projectequipmentallocation->end_date);
$project_id = $projectequipmentallocation->project_id;
}
$this->view->set('tasks', $this->getTaskList($project_id));
$this->getEquipmentAllocation($default_equipment, $dates['start_date'], $dates['end_date']);
}