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


PHP Company::setName方法代码示例

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


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

示例1: loadCompany

function loadCompany($jsonObject)
{
    $id = $jsonObject->id;
    // name
    $request = "SELECT * FROM company WHERE id = {$id}";
    $result = mysql_query($request);
    $row = mysql_fetch_object($result);
    $name = $row->name;
    // departments
    $departments = array();
    $request = "SELECT * FROM department WHERE cid = {$id} AND did IS NULL";
    $result = mysql_query($request);
    $count = mysql_num_rows($result);
    while ($row = mysql_fetch_object($result)) {
        $departments[] = $row->name;
    }
    // total
    $request = "SELECT * FROM employee";
    $result = mysql_query($request);
    $total = 0;
    while ($row = mysql_fetch_object($result)) {
        $total += $row->salary;
    }
    // create company object
    $company = new Company();
    $company->setDepartments($departments);
    $company->setName($name);
    $company->setTotal($total);
    // return company object
    return $company;
}
开发者ID:nuzil,项目名称:101repo,代码行数:31,代码来源:companyServer.php

示例2: createAndSaveMultipleCompanies

 public function createAndSaveMultipleCompanies($count)
 {
     for ($i = 65; $i <= 65 + $count - 1; $i++) {
         $company = new Company();
         $company->setName(sprintf($this->getCreatedCompanynamePattern(), chr($i)));
         $company->save();
     }
 }
开发者ID:rmhdev,项目名称:sfSesame,代码行数:8,代码来源:CompanyTestFunctional.class.php

示例3: createCompany

 /**
  * @param int $id
  * @param string $name
  * @param string $contactname
  * @param string $email
  * @param string $phonenumber
  * @param string $region
  * @param string $website
  * @param int $status
  * @return Company
  */
 public static function createCompany($id, $name, $contactname, $email, $phonenumber, $region, $website, $status)
 {
     $newCompany = new Company();
     $newCompany->setId($id);
     $newCompany->setName($name);
     $newCompany->setContactName($contactname);
     $newCompany->setEmail($email);
     $newCompany->setPhoneNumber($phonenumber);
     $newCompany->setRegion($region);
     $newCompany->setWebsite($website);
     $newCompany->setStatus($status);
     return $newCompany;
 }
开发者ID:euBatham,项目名称:javacature,代码行数:24,代码来源:CompanyFactory.class.php

示例4: mapDtoToCompany

 public function mapDtoToCompany(CompanyDto $companyDto)
 {
     $company = new Company();
     $company->setId($companyDto->getId());
     $company->setName($companyDto->getName());
     $company->setContactName($companyDto->getContactName());
     $company->setEmail($companyDto->getEmail());
     $company->setPhoneNumber($companyDto->getPhoneNumber());
     $company->setRegion($companyDto->getRegion());
     $company->setWebsite($companyDto->getWebsite());
     $company->setStatus($companyDto->getStatus());
     return $company;
 }
开发者ID:euBatham,项目名称:javacature,代码行数:13,代码来源:CompanyMapper.class.php

示例5: loadCompany

function loadCompany($jsonObject)
{
    $id = $jsonObject->id;
    // name
    $request = "SELECT * FROM company WHERE id = {$id}";
    $result = mysql_query($request);
    $row = mysql_fetch_object($result);
    // create company object
    $company = new Company();
    $company->setId($row->id);
    $company->setName($row->name);
    // departments
    $company->setDepartments(loadDepartmentsForCompany($id));
    // return company object
    return $company;
}
开发者ID:nuzil,项目名称:101repo,代码行数:16,代码来源:treeServer.php

示例6: createAction

 /**
  * Creates a new company
  */
 public function createAction()
 {
     if (!$this->request->isPost()) {
         return $this->dispatcher->forward(array("controller" => "company", "action" => "index"));
     }
     $company = new Company();
     $company->setId($this->request->getPost("id"));
     $company->setName($this->request->getPost("name"));
     if (!$company->save()) {
         foreach ($company->getMessages() as $message) {
             $this->flash->error($message);
         }
         return $this->dispatcher->forward(array("controller" => "company", "action" => "new"));
     }
     $this->flash->success("company was created successfully");
     return $this->dispatcher->forward(array("controller" => "company", "action" => "index"));
 }
开发者ID:andresfranco,项目名称:Phalcontest,代码行数:20,代码来源:CompanyController.php

示例7: loadCompany

function loadCompany($jsonObject)
{
    $id = $jsonObject->id;
    // name
    $request = "SELECT * FROM company WHERE id = {$id}";
    $result = mysql_query($request);
    $row = mysql_fetch_object($result);
    $name = $row->name;
    // total
    $request = "SELECT * FROM employee";
    $result = mysql_query($request);
    $total = 0;
    while ($row = mysql_fetch_object($result)) {
        $total += $row->salary;
    }
    // create company object
    $company = new Company();
    $company->setId($id);
    $company->setName($name);
    $company->setTotal($total);
    // return company object
    return $company;
}
开发者ID:nuzil,项目名称:101repo,代码行数:23,代码来源:companyServer.php

示例8: die

 /**
  * 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

示例9: add

 /**
  * Add contact
  *
  * @access public
  * @param void
  * @return null
  */
 function add()
 {
     $this->setTemplate('add_contact');
     $company_id = get_id('company_id', null, 0);
     $company = Companies::findById($company_id);
     if (!Contact::canAdd(logged_user(), $company)) {
         flash_error(lang('no access permissions'));
         $this->redirectToReferer(get_url('dashboard', 'index'));
     }
     // if
     $contact = new Contact();
     $im_types = ImTypes::findAll(array('order' => '`id`'));
     $contact_data = array_var($_POST, 'contact');
     if (!is_array($contact_data)) {
         $contact_data = array('company_id' => $company_id);
         // array
     }
     // if
     $user_data = array_var($contact_data, 'user');
     if (!is_array($user_data)) {
         $user_data = array('password_generator' => 'random');
         // array
     }
     // if
     tpl_assign('contact', $contact);
     tpl_assign('company', $company);
     tpl_assign('contact_data', $contact_data);
     tpl_assign('user_data', $user_data);
     tpl_assign('im_types', $im_types);
     $avatar = array_var($_FILES, 'new_avatar');
     if (is_array($avatar) && isset($avatar['size']) && $avatar['size'] != 0) {
         try {
             if (!isset($avatar['name']) || !isset($avatar['type']) || !isset($avatar['size']) || !isset($avatar['tmp_name']) || !is_readable($avatar['tmp_name'])) {
                 throw new InvalidUploadError($avatar, lang('error upload file'));
             }
             // if
             $valid_types = array('image/jpg', 'image/jpeg', 'image/pjpeg', 'image/gif', 'image/png');
             $max_width = config_option('max_avatar_width', 50);
             $max_height = config_option('max_avatar_height', 50);
             if ($avatar['size']) {
                 if (!in_array($avatar['type'], $valid_types) || !($image = getimagesize($avatar['tmp_name']))) {
                     throw new InvalidUploadError($avatar, lang('invalid upload type', 'JPG, GIF, PNG'));
                 } elseif (!$contact->setAvatar($avatar['tmp_name'], $max_width, $max_height, false)) {
                     throw new Error($avatar, lang('error edit avatar'));
                     $contact->setAvatarFile('');
                 }
                 // if
             }
             // if
         } catch (Exception $e) {
             flash_error($e->getMessage());
         }
     } else {
         $contact->setAvatarFile('');
     }
     // if
     if (is_array(array_var($_POST, 'contact'))) {
         $contact->setFromAttributes($contact_data);
         try {
             // Company info
             if ($_POST['contact']['company']['what'] == 'existing') {
                 $company_id = $_POST['contact']['company_id'];
             } else {
                 $company = new Company();
                 $company->setName($_POST['contact']['company']['name']);
                 $company->setTimezone($_POST['contact']['company']['timezone']);
                 $company->setClientOfId(owner_company()->getId());
                 $company->save();
                 $company_id = $company->getId();
             }
             // if
             $contact->setCompanyId($company_id);
             $contact->setUserId(0);
             $contact->save();
             if (plugin_active('tags')) {
                 $contact->setTagsFromCSV(array_var($contact_data, 'tags'));
             }
             $contact->clearImValues();
             foreach ($im_types as $im_type) {
                 $value = trim(array_var($contact_data, 'im_' . $im_type->getId()));
                 if ($value != '') {
                     $contact_im_value = new ContactImValue();
                     $contact_im_value->setContactId($contact->getId());
                     $contact_im_value->setImTypeId($im_type->getId());
                     $contact_im_value->setValue($value);
                     $contact_im_value->setIsDefault(array_var($contact_data, 'default_im') == $im_type->getId());
                     $contact_im_value->save();
                 }
                 // if
             }
             // foreach
             ApplicationLogs::createLog($contact, null, ApplicationLogs::ACTION_ADD);
             DB::commit();
//.........这里部分代码省略.........
开发者ID:federosky,项目名称:ProjectPier-Core,代码行数:101,代码来源:ContactsController.class.php

示例10: Company

<?php

$object = new Company();
// handle form submission
if (isset($_POST['submit'])) {
    $error_flag = false;
    /// validation
    // validation for $name
    $name = isset($_POST["name"]) ? strip_tags($_POST["name"]) : null;
    if (empty($name)) {
        Message::register(new Message(Message::DANGER, i18n(array("en" => "name is required.", "zh" => "请填写name"))));
        $error_flag = true;
    }
    /// proceed submission
    // proceed for $name
    $object->setName($name);
    if ($error_flag == false) {
        if ($object->save()) {
            Message::register(new Message(Message::SUCCESS, i18n(array("en" => "Record saved", "zh" => "记录保存成功"))));
            HTML::forwardBackToReferer();
        } else {
            Message::register(new Message(Message::DANGER, i18n(array("en" => "Record failed to save", "zh" => "记录保存失败"))));
        }
    }
}
$html = new HTML();
$html->renderOut('core/backend/html_header', array('title' => i18n(array('en' => 'Create Company', 'zh' => 'Create 公司'))));
$html->output('<div id="wrapper">');
$html->renderOut('core/backend/header');
$html->renderOut('company/backend/company_create', array('object' => $object));
$html->output('</div>');
开发者ID:jeffreycai,项目名称:chaoliu,代码行数:31,代码来源:company_create.php

示例11: array


//.........这里部分代码省略.........
             if (is_array($avatar) && isset($avatar['size']) && $avatar['size'] != 0) {
                 try {
                     if (!isset($avatar['name']) || !isset($avatar['type']) || !isset($avatar['size']) || !isset($avatar['tmp_name']) || !is_readable($avatar['tmp_name'])) {
                         throw new InvalidUploadError($avatar, lang('error upload file'));
                     }
                     // if
                     $valid_types = array('image/jpg', 'image/jpeg', 'image/pjpeg', 'image/gif', 'image/png');
                     $max_width = config_option('max_avatar_width', 50);
                     $max_height = config_option('max_avatar_height', 50);
                     if ($avatar['size']) {
                         if (!in_array($avatar['type'], $valid_types) || !($image = getimagesize($avatar['tmp_name']))) {
                             throw new InvalidUploadError($avatar, lang('invalid upload type', 'JPG, GIF, PNG'));
                         } elseif (!$contact->setAvatar($avatar['tmp_name'], $max_width, $max_height, false)) {
                             throw new Error($avatar, lang('error edit avatar'));
                             $contact->setAvatarFile('');
                         }
                         // if
                     }
                     // if
                 } catch (Exception $e) {
                     flash_error($e->getMessage());
                 }
             } else {
                 $contact->setAvatarFile('');
             }
             // if
             try {
                 DB::beginWork();
                 $contact->setFromAttributes($new_contact_data);
                 if (array_var($company_data, 'what') == 'existing') {
                     $company_id = $new_contact_data['company_id'];
                 } else {
                     $company = new Company();
                     $company->setName(array_var($company_data, 'name'));
                     $company->setTimezone(array_var($company_data, 'timezone'));
                     $company->setClientOfId(owner_company()->getId());
                     $company->save();
                     $company_id = $company->getId();
                 }
                 // if
                 $contact->setCompanyId($company_id);
                 // User account info
                 if (array_var($user_data, 'add_account') == "yes") {
                     $user = new User();
                     $user->setFromAttributes($user_data);
                     if (array_var($user_data, 'password_generator') == 'random') {
                         // Generate random password
                         $password = substr(sha1(uniqid(rand(), true)), rand(0, 25), 13);
                     } else {
                         // Validate user input
                         $password = array_var($user_data, 'password');
                         if (trim($password) == '') {
                             throw new Error(lang('password value required'));
                         }
                         // if
                         if ($password != array_var($user_data, 'password_a')) {
                             throw new Error(lang('passwords dont match'));
                         }
                         // if
                     }
                     // if
                     $user->setPassword($password);
                     $user->save();
                     $contact->setUserId($user->getId());
                 } else {
                     $contact->setUserId(0);
开发者ID:bklein01,项目名称:Project-Pier,代码行数:67,代码来源:ProjectController.class.php

示例12: unset

 function import_from_vcard()
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     @set_time_limit(0);
     ini_set('auto_detect_line_endings', '1');
     if (isset($_GET['from_menu']) && $_GET['from_menu'] == 1) {
         unset($_SESSION['go_back']);
     }
     if (isset($_SESSION['go_back'])) {
         unset($_SESSION['go_back']);
         ajx_current("start");
     }
     tpl_assign('import_type', 'contact');
     if (!Contact::canAdd(logged_user(), active_or_personal_project())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     // if
     $this->setTemplate('vcard_import');
     $filedata = array_var($_FILES, 'vcard_file');
     if (is_array($filedata) && !array_var($_GET, 'step2')) {
         $filename = ROOT . '/tmp/' . logged_user()->getId() . 'temp.vcf';
         copy($filedata['tmp_name'], $filename);
         //ajx_current("empty");
     } else {
         if (array_var($_GET, 'step2')) {
             $filename = ROOT . '/tmp/' . logged_user()->getId() . 'temp.vcf';
             $result = $this->read_vcard_file($filename);
             unlink($filename);
             $import_result = array('import_ok' => array(), 'import_fail' => array());
             foreach ($result as $contact_data) {
                 try {
                     DB::beginWork();
                     if (isset($contact_data['photo_tmp_filename'])) {
                         $file_id = FileRepository::addFile($contact_data['photo_tmp_filename'], array('public' => true));
                         $contact_data['picture_file'] = $file_id;
                         unlink($contact_data['photo_tmp_filename']);
                         unset($contact_data['photo_tmp_filename']);
                     }
                     if (isset($contact_data['company_name'])) {
                         $company = Companies::findOne(array("conditions" => "`name` = '" . mysql_real_escape_string($contact_data['company_name']) . "'"));
                         if ($company == null) {
                             $company = new Company();
                             $company->setName($contact_data['company_name']);
                             $company->setClientOfId(logged_user()->getCompanyId());
                             $company->save();
                             ApplicationLogs::createLog($company, null, ApplicationLogs::ACTION_ADD);
                         }
                         $contact_data['company_id'] = $company->getId();
                         unset($contact_data['company_name']);
                     }
                     $contact_data['import_status'] = '(' . lang('updated') . ')';
                     $fname = mysql_real_escape_string(array_var($contact_data, "firstname"));
                     $lname = mysql_real_escape_string(array_var($contact_data, "lastname"));
                     $contact = Contacts::findOne(array("conditions" => "firstname = '" . $fname . "' AND lastname = '" . $lname . "' OR email <> '' AND email = '" . array_var($contact_data, "email") . "'"));
                     $log_action = ApplicationLogs::ACTION_EDIT;
                     if (!$contact) {
                         $contact = new Contact();
                         $contact_data['import_status'] = '(' . lang('new') . ')';
                         $log_action = ApplicationLogs::ACTION_ADD;
                         $can_import = active_project() != null ? $contact->canAdd(logged_user(), active_project()) : can_manage_contacts(logged_user());
                     } else {
                         $can_import = $contact->canEdit(logged_user());
                     }
                     if ($can_import) {
                         $contact->setFromAttributes($contact_data);
                         $contact->save();
                         ApplicationLogs::createLog($contact, null, $log_action);
                         $contact->setTagsFromCSV(array_var($_GET, 'tags'));
                         if (active_project() instanceof Project) {
                             $pc = ProjectContacts::findOne(array("conditions" => "contact_id = " . $contact->getId() . " AND project_id = " . active_project()->getId()));
                             if (!$pc) {
                                 $pc = new ProjectContact();
                                 $pc->setContactId($contact->getId());
                                 $pc->setProjectId(active_project()->getId());
                                 $pc->setRole(array_var($contact_data, 'role'));
                                 $pc->save();
                             }
                             $contact->addToWorkspace(active_project());
                         }
                         $import_result['import_ok'][] = array('firstname' => $fname, 'lastname' => $lname, 'email' => $contact_data['email'], 'import_status' => $contact_data['import_status']);
                     } else {
                         throw new Exception(lang('no access permissions'));
                     }
                     DB::commit();
                 } catch (Exception $e) {
                     DB::rollback();
                     $fail_msg = substr_utf($e->getMessage(), strpos_utf($e->getMessage(), "\r\n"));
                     $import_result['import_fail'][] = array('firstname' => $fname, 'lastname' => $lname, 'email' => $contact_data['email'], 'import_status' => $contact_data['import_status'], 'fail_message' => $fail_msg);
                 }
             }
             $_SESSION['go_back'] = true;
             tpl_assign('import_result', $import_result);
         }
     }
//.........这里部分代码省略.........
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:101,代码来源:ContactController.class.php

示例13: die

 /**
  * 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


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