当前位置: 首页>>代码示例>>PHP>>正文


PHP Companies::delete方法代码示例

本文整理汇总了PHP中Companies::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Companies::delete方法的具体用法?PHP Companies::delete怎么用?PHP Companies::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Companies的用法示例。


在下文中一共展示了Companies::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: complete_installation

 /**
  * Finish the installation - create owner company and administrator
  *
  * @param void
  * @return null
  */
 function complete_installation()
 {
     if (Companies::getOwnerCompany() instanceof Company) {
         die('Owner company already exists');
         // Somebody is trying to access this method even if the user already exists
     }
     // if
     $this->setLayout('complete_install');
     $form_data = array_var($_POST, 'form');
     tpl_assign('form_data', $form_data);
     if (array_var($form_data, 'submitted') == 'submitted') {
         try {
             $admin_password = trim(array_var($form_data, 'admin_password'));
             $admin_password_a = trim(array_var($form_data, 'admin_password_a'));
             if (trim($admin_password) == '') {
                 throw new Error(lang('password value required'));
             }
             // if
             if ($admin_password != $admin_password_a) {
                 throw new Error(lang('passwords dont match'));
             }
             // if
             DB::beginWork();
             Users::delete();
             // clear users table
             Companies::delete();
             // clear companies table
             // Create the administrator user
             $administrator = new User();
             $administrator->setId(1);
             $administrator->setUsername(array_var($form_data, 'admin_username'));
             $administrator->setEmail(array_var($form_data, 'admin_email'));
             $administrator->setPassword($admin_password);
             $administrator->setIsAdmin(true);
             $administrator->setAutoAssign(true);
             $administrator->save();
             // Create the contact for administrator
             $administrator_contact = new Contact();
             $administrator_contact->setId(1);
             $administrator_contact->setCompanyId(1);
             $administrator_contact->setEmail(array_var($form_data, 'admin_email'));
             $administrator_contact->setUserId($administrator->getId());
             $administrator_contact->setDisplayName($administrator->getUsername());
             $administrator_contact->save();
             // Create a company
             $company = new Company();
             $company->setId(1);
             $company->setClientOfId(0);
             $company->setName(array_var($form_data, 'company_name'));
             $company->setCreatedById(1);
             $company->save();
             DB::commit();
             $this->redirectTo('access', 'login');
         } catch (Exception $e) {
             tpl_assign('error', $e);
             DB::rollback();
         }
         // try
     }
     // if
 }
开发者ID:federosky,项目名称:ProjectPier-Core,代码行数:67,代码来源:AccessController.class.php

示例2: onDelete

 private function onDelete()
 {
     if ($this->_accessLevel < ACCESS_LEVEL_DELETE) {
         $this->listByView('Invalid user level for action.');
         return;
     }
     /* Bail out if we don't have a valid company ID. */
     if (!$this->isRequiredIDValid('companyID', $_GET)) {
         $this->listByView('Invalid company ID.');
         return;
     }
     $companyID = $_GET['companyID'];
     $companies = new Companies($this->_siteID);
     $rs = $companies->get($companyID);
     if (empty($rs)) {
         $this->listByView('The specified company ID could not be found.');
         return;
     }
     if ($rs['defaultCompany'] == 1) {
         $this->listByView('Cannot delete internal postings company.');
         return;
     }
     if (!eval(Hooks::get('CLIENTS_ON_DELETE_PRE'))) {
         return;
     }
     $companies->delete($companyID);
     /* Delete the MRU entry if present. */
     $_SESSION['CATS']->getMRU()->removeEntry(DATA_ITEM_COMPANY, $companyID);
     if (!eval(Hooks::get('CLIENTS_ON_DELETE_POST'))) {
         return;
     }
     CATSUtility::transferRelativeURI('m=companies&a=listByView');
 }
开发者ID:rankinp,项目名称:OpenCATS,代码行数:33,代码来源:CompaniesUI.php

示例3: complete_installation

 /**
  * Finish the installation - create owner company and administrator
  *
  * @param void
  * @return null
  */
 function complete_installation()
 {
     if (Companies::getOwnerCompany() instanceof Company) {
         die('Owner company already exists');
         // Somebody is trying to access this method even if the user already exists
     }
     // if
     $form_data = array_var($_POST, 'form');
     tpl_assign('form_data', $form_data);
     if (array_var($form_data, 'submited') == 'submited') {
         try {
             $admin_password = trim(array_var($form_data, 'admin_password'));
             $admin_password_a = trim(array_var($form_data, 'admin_password_a'));
             if (trim($admin_password) == '') {
                 throw new Error(lang('password value required'));
             }
             // if
             if ($admin_password != $admin_password_a) {
                 throw new Error(lang('passwords dont match'));
             }
             // if
             DB::beginWork();
             Users::delete();
             // clear users table
             Companies::delete();
             // clear companies table
             // Create the administrator user
             $administrator = new User();
             $administrator->setId(1);
             $administrator->setCompanyId(1);
             $administrator->setUsername(array_var($form_data, 'admin_username'));
             $administrator->setEmail(array_var($form_data, 'admin_email'));
             $administrator->setPassword($admin_password);
             $administrator->setCanEditCompanyData(true);
             $administrator->setCanManageConfiguration(true);
             $administrator->setCanManageSecurity(true);
             $administrator->setCanManageWorkspaces(true);
             $administrator->setCanManageContacts(true);
             $administrator->setCanManageTemplates(true);
             $administrator->setCanManageReports(true);
             $administrator->setCanManageTime(true);
             $administrator->setCanAddMailAccounts(true);
             $administrator->setAutoAssign(false);
             $administrator->setPersonalProjectId(1);
             $administrator->setType('admin');
             $administrator->save();
             $group = new Group();
             $group->setName('administrators');
             $group->setAllPermissions(true);
             $group->setId(Group::CONST_ADMIN_GROUP_ID);
             $group->save();
             $group_user = new GroupUser();
             $group_user->setGroupId(Group::CONST_ADMIN_GROUP_ID);
             $group_user->setUserId($administrator->getId());
             $group_user->save();
             $project = new Project();
             $project->setId(1);
             $project->setP1(1);
             $project->setName(new_personal_project_name($administrator->getUsername()));
             $project->setDescription(lang('files'));
             $project->setCreatedById($administrator->getId());
             $project->save();
             $project_user = new ProjectUser();
             $project_user->setProjectId($project->getId());
             $project_user->setUserId($administrator->getId());
             $project_user->setCreatedById($administrator->getId());
             $project_user->setAllPermissions(true);
             $project_user->save();
             // Create a company
             $company = new Company();
             $company->setId(1);
             $company->setClientOfId(0);
             $company->setName(array_var($form_data, 'company_name'));
             $company->setCreatedById(1);
             $company->save();
             DB::commit();
             $this->redirectTo('access', 'login');
         } catch (Exception $e) {
             tpl_assign('error', $e);
             DB::rollback();
         }
         // try
     }
     // if
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:91,代码来源:AccessController.class.php


注:本文中的Companies::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。