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


PHP Branch::setCode方法代码示例

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


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

示例1: executeBulkupload

 public function executeBulkupload()
 {
     if ($this->getRequest()->getFileName('csvfile')) {
         $fileName = md5($this->getRequest()->getFileName('csvfile') . time() . rand(0, 99999));
         $ext = $this->getRequest()->getFileExtension('csvfile');
         $this->getRequest()->moveFile('csvfile', sfConfig::get('sf_upload_dir') . "//csvfiles//" . $fileName . ".csv");
         $fullname = $fileName . ".csv";
         //$fullpath = '/uploads/csvfiles/'.$fullname;
         $fp = sfConfig::get('sf_upload_dir') . "//csvfiles//" . $fileName . ".csv";
         $reader = new sfCsvReader($fp, ',', '"');
         $reader->open();
         $i = 1;
         $exist;
         $ignore;
         $log;
         $ignoreflag = 0;
         $success = 0;
         while ($data = $reader->read()) {
             $name[] = array();
             $name = explode(' ', $data[0]);
             $roll = $data[1];
             $enrol = $data[2];
             $branch = $data[3];
             $degree = $data[4];
             $year = $data[5];
             $c = new Criteria();
             $c->add(UserPeer::ENROLMENT, $enrol);
             $user = UserPeer::doSelectOne($c);
             if (!$user) {
                 $c = new Criteria();
                 $c->add(BranchPeer::CODE, $branch);
                 $br = BranchPeer::doSelectOne($c);
                 if (!$br) {
                     $br = new Branch();
                     $br->setName($branch);
                     $br->setCode($branch);
                     $br->save();
                 }
                 $c = new Criteria();
                 $c->add(DegreePeer::NAME, $degree);
                 $dg = DegreePeer::doSelectOne($c);
                 if (!$dg) {
                     $dg = new Degree();
                     $dg->setName($degree);
                     $dg->save();
                 }
                 $user = new User();
                 if ($roll) {
                     $user->setRoll($roll);
                     $user->setRollflag(sfConfig::get('app_defaultprivacy_roll'));
                 }
                 if ($enrol) {
                     $user->setEnrolment($enrol);
                     $user->setEnrolflag(sfConfig::get('app_defaultprivacy_enrol'));
                 } else {
                     $ignoreflag = 1;
                 }
                 if ($year) {
                     $user->setGraduationyear($year);
                     $user->setGraduationyearflag(sfConfig::get('app_defaultprivacy_year'));
                 }
                 $user->setBranchId($br->getId());
                 $user->setBranchflag(sfConfig::get('app_defaultprivacy_branch'));
                 $user->setDegreeId($dg->getId());
                 $user->setDegreeflag(sfConfig::get('app_defaultprivacy_degree'));
                 $user->setIslocked(sfConfig::get('app_islocked_unclaimed'));
                 $user->setUsertype(sfConfig::get('app_usertypecode_Alumni'));
                 $lastname = '';
                 $personal = new Personal();
                 $name[0] = str_replace('.', '', $name[0]);
                 $personal->setFirstname($name[0]);
                 if ($name[3]) {
                     $name[1] = str_replace('.', '', $name[1]);
                     $name[2] = str_replace('.', '', $name[2]);
                     $name[3] = str_replace('.', '', $name[3]);
                     $midname = $name[1] . " " . $name[2];
                     $personal->setMiddlename($midname);
                     $personal->setLastname($name[3]);
                     $lastname = $name[3];
                 } elseif ($name[2]) {
                     $name[1] = str_replace('.', '', $name[1]);
                     $name[2] = str_replace('.', '', $name[2]);
                     $personal->setMiddlename($name[1]);
                     $personal->setLastname($name[2]);
                     $lastname = $name[2];
                 } elseif ($name[1]) {
                     $name[1] = str_replace('.', '', $name[1]);
                     $personal->setLastname($name[1]);
                     $lastname = $name[1];
                 }
                 $uname_suffix = $branch . substr($year, -2);
                 if ($lastname) {
                     $username = $name[0] . '.' . $lastname . '@';
                 } else {
                     $username = $name[0] . '@';
                 }
                 $temp = 1;
                 $tempusername = $username;
                 while ($this->uniqueuser($tempusername . $uname_suffix)) {
                     $tempusername = $username . $temp;
//.........这里部分代码省略.........
开发者ID:Ayaan123,项目名称:alumnisangam,代码行数:101,代码来源:actions.class.php


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