/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = ClientEmployee::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); \Yii::warning('yjhu_debugging: ' . \yii\helpers\Json::encode($params)); \Yii::warning('yjhu_debugging: ' . \yii\helpers\Json::encode($this)); $this->load($params); \Yii::warning('yjhu_debugging: ' . \yii\helpers\Json::encode($this)); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query = $query->joinWith('organizations'); $query->andFilterWhere(['employee_id' => $this->employee_id, 'client_id' => $this->client_id]); $query->andFilterWhere(['like', 'name', $this->name]); $root_org = ClientOrganization::findOne(['organization_id' => $this->organization_id]); if (empty($root_org)) { $this->organization_id = 1; $root_org = ClientOrganization::findOne(['organization_id' => 1]); } $query->andFilterWhere(['client_organization.organization_id' => $root_org->getSubordinateIdArray()]); if (!empty($this->search_keyword)) { $query->leftJoin('client_employee_mobile', 'client_employee_mobile.employee_id = client_employee.employee_id'); $query->andFilterWhere(['like', 'name', $this->search_keyword]); $query->orFilterWhere(['like', 'client_employee_mobile.mobile', $this->search_keyword]); } return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = ClientOutlet::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 24]]); \Yii::warning(__METHOD__ . \yii\helpers\Json::encode($params)); \Yii::warning(__METHOD__ . \yii\helpers\Json::encode($this)); $this->load($params); \Yii::warning(__METHOD__ . \yii\helpers\Json::encode($this)); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['outlet_id' => $this->outlet_id, 'client_id' => $this->client_id, 'supervision_organization_id' => $this->supervision_organization_id, 'category' => $this->category, 'longitude' => $this->longitude, 'latitude' => $this->latitude, 'original_office_id' => $this->original_office_id]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'telephone', $this->telephone])->andFilterWhere(['like', 'pics', $this->pics]); $query->andFilterWhere(['supervision_organization_id' => ClientOrganization::findOne(['organization_id' => $this->msc_id])->getMscIdArray()]); \Yii::warning(__METHOD__ . \yii\helpers\Json::encode($query)); return $dataProvider; }
public function actionOrganizationChart($filename = 'organization-chart.csv') { $xyunicom = \app\models\WosoClient::findOne(['title_abbrev' => '襄阳联通']); if (empty($xyunicom)) { die('不能找到襄阳联通。'); } $filepathname = Yii::$app->getRuntimePath() . DIRECTORY_SEPARATOR . 'imported_data' . DIRECTORY_SEPARATOR . $filename; $fh = fopen($filepathname, "r"); while (!feof($fh)) { $line = trim(fgets($fh)); if (empty($line) || strlen($line) == 0) { continue; } $fields = explode(",", $line); $subordinate_name = trim($fields[0]); $subordinate_name_utf8 = iconv('GBK', 'UTF-8//IGNORE', $subordinate_name); $superior_name = trim($fields[1]); $superior_name_utf8 = iconv('GBK', 'UTF-8//IGNORE', $superior_name); echo "{$subordinate_name}({$subordinate_name_utf8}),{$superior_name}({$superior_name_utf8}))" . PHP_EOL; $subordinate_organization = \app\models\ClientOrganization::findOne(['title' => $subordinate_name_utf8]); if (empty($subordinate_organization)) { $subordinate_organization = new \app\models\ClientOrganization(); $subordinate_organization->client_id = $xyunicom->client_id; $subordinate_organization->title = $subordinate_name_utf8; $subordinate_organization->save(false); } $superior_organization = \app\models\ClientOrganization::findOne(['title' => $superior_name_utf8]); if (empty($superior_organization)) { $superior_organization = new \app\models\ClientOrganization(); $superior_organization->client_id = $xyunicom->client_id; $superior_organization->title = $superior_name_utf8; $superior_organization->save(false); } $row = (new \yii\db\Query())->select('*')->from('client_organization_chart')->where(['subordinate_id' => $subordinate_organization->organization_id, 'superior_id' => $superior_organization->organization_id])->one(); if (false === $row) { \Yii::$app->db->createCommand()->insert('client_organization_chart', ['subordinate_id' => $subordinate_organization->organization_id, 'superior_id' => $superior_organization->organization_id])->execute(); } } fclose($fh); }
public function actionClientOrganization($gh_id, $openid, $organization_id, $backwards = true, $pop = false) { if (!$backwards) { \app\models\utils\BrowserHistory::delete($gh_id, $openid); \app\models\utils\BrowserHistory::push($gh_id, $openid); } else { if ($pop) { \app\models\utils\BrowserHistory::pop($gh_id, $openid); } else { \app\models\utils\BrowserHistory::push($gh_id, $openid); } } $wx_user = \app\models\MUser::findOne(['gh_id' => $gh_id, 'openid' => $openid]); $organization = \app\models\ClientOrganization::findOne(['organization_id' => $organization_id]); $this->layout = false; return $this->render('client-organization', ['wx_user' => $wx_user, 'organization' => $organization, 'backwards' => $backwards]); }
public function actionIndex() { echo 'Hello, world!!'; //U::W(U::getQqAddress(114.253578, 30.585514)); $arr = U::getMobileLocation('13871407676'); if (!empty($arr['errcode'])) { U::W(['err', $arr]); } else { U::W($arr); } return; $clientOrganization = ClientOrganization::findOne(50); U::W($clientOrganization); $directSubordinateOrganizations = $clientOrganization->directSubordinateOrganizations; U::W($directSubordinateOrganizations); }
<div class="caption"> <span class="caption-subject"> <i class="fa fa-sitemap"></i> 部门 </span> <span class="caption-helper"> 选择部门进行过滤 </span> </div> <div class="actions"></div> </div> <div class="portlet-body"> <div id="organization_tree"> <ul> <?php $root = \app\models\ClientOrganization::findOne(['organization_id' => 1]); echoJsTreeNode($searchModel, $root); ?> </ul> </div> </div> </div> <div class="portlet light"> <div class="row"> <div id="member-promotion-daterange" class='pull-left' style="display:inline; margin-right: 30px;background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc;"> <i class="glyphicon glyphicon-calendar fa fa-calendar"></i> <span><?php echo date('Y年m月d日', strtotime('-1 month')) . ' 至 ' . date('Y年m月d日'); ?> </span> <b class="caret"></b> </div>