yii-extensions

Importing csv into mongodb using PHP code

℡╲_俬逩灬. 提交于 2020-08-26 07:17:08
问题 Im using MongoCollection::batchInsert() to insert csv data into mongodb, <?php $mongo = new Mongo("mongodb://192.168.1.7:27017"); $collection = $mongo->test->cartoons; $row = 1; $handle = fopen(dirname(Yii::app()->request->scriptFile).'/images/importcsv/upload.csv', "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); echo "<p> $num fields in line $row: <br /></p>\n"; $row++; $users = array(); for ($c=0; $c < $num; $c++) { echo 'data--'.$data[$c] . "<br />\n";

Yii: how to use actionupload() in actioncreate()

梦想的初衷 提交于 2020-01-17 06:07:10
问题 i am yiibie and i am trying to use the uploadaction() function in the createaction() function so that i can upload videos and can also manage videos. I am using multiuploadfile extension. I dont know how to merge the upload function into create function. This is the code of my VideoController which has both the actionUpload() and actioncreate() function. <?php class VideoController extends RController { /** * @var string the default layout for the views. Defaults to '//layouts/column2',

How to config and install Phundament 3 with MySQL?

旧巷老猫 提交于 2020-01-07 02:31:20
问题 Downloaded and place phundament3 in local machine, ya its working but not when trying to config /install it with Mysql database followed like installation doc , where I can find its Mysql dump? if installation do all for me then how to do in local? can any one explain steps, using Ubuntu 11.04 回答1: If you accidentally mixed up your installation, eg. you've installed Phundament with a SQLite database (which is the default), but you want to install it with MySQL, take the following steps:

Yii::app()->getModule('user') is not returning the right value view/layout/main.php

戏子无情 提交于 2020-01-06 08:00:51
问题 Yii::app()->getModule('user') is not returning the right value in view/layouts/main.php I am using Yii-User YII-User Extension to manage the User related features. When I Yii::app()->getModule('user')->loginUrl, I get Trying to get property of non-object at array('url'=>Yii::app()->getModule('user')->loginUrl, 'label'=>Yii::app()->getModule('user')->t("Login"), 'visible'=>Yii::app()->user->isGuest), Pls tell me whats going wrong, is it a known issue or something like that. Here is the config

yii : how to redirect to different page after logged in?

旧巷老猫 提交于 2020-01-05 10:04:20
问题 Q : how to redirect to different page after logged in? status : I've custom user role and I want to redirect to different page for different user. e.g hr manager -> employee/index, account manager -> account/index. I'm using yii 1.1.xx and rights module. yii and rights module are going with green. update question's info this is the rank tbl this is user tbl If the rank is Account Manager, the web site will redirect to account/index. If the rank is HR manager, the web site will redirect to

Yii2: Replace default confirmation message used by Gridview with Sweet alert

大城市里の小女人 提交于 2019-12-31 01:56:48
问题 I am using yii2mod/yii2-sweet-alert in my projects, I am using it on basic and advanced themes, and I love it. The question. How can I change the grid default confirmation dialog that is a plain javascript confirmation in order to use Sweet-alert to make it look better? I already tried modifying the button's template for the delete, because if you want to change the message you will do the following: [ 'class' => ActionColumn::className(), 'template' => '{update}{delete}', 'buttons' => [

keep getting upload php $_FILES error = 3 (partially uploaded)

我与影子孤独终老i 提交于 2019-12-31 00:45:23
问题 I am using dropzone extension for Yii framework to upload some files by registered users. Everything working well but some users for some files that they trying to upload it's return error = 3 which it's happens when the uploaded file was only partially uploaded. $file_error = $_FILES['Project']['error']['file']; if ($file_error != 0) { mail('myemail@gmail.com', 'fileError',json_encode($_FILES['Project'])); } i'am receiving a lot of emails from this function JSON received {"name":{"file":"3

Yii2:how to get return value in view from model?

人走茶凉 提交于 2019-12-25 19:36:53
问题 I have a table name "staff".Staff table has one to many relation with attendance table. In model Staff.php public function getAttendances() { if(isset($_GET['startdat'])) $start_date=$_GET['startdat']; if(isset($_GET['enddate'])) $end_date=$_GET['enddate']; if(isset($_GET['startdat'])){ return $this->hasMany(Attendance::className(), ['staff_id' => 'id']) ->where('daytime >= "'.$start_date.'" and daytime<="'.$end_date.'"'); } else{ return $this->hasMany(Attendance::className(), ['staff_id' =>

Yii: Can not Display Data in Grid View

末鹿安然 提交于 2019-12-25 07:16:28
问题 I can't list data in grid using yii framework. My controller is Sitecontroller.php , My view is list_jobseeker.php . I got the error: Parse error: syntax error, unexpected '*', expecting ']' in C:\wamp\www\yii_new\framework\base\CComponent.php(612) : eval()'d code on line 1 Anybody give any suggestion to correct these issue? My controller: public function actionlist_jobseeker() { $session_id=Yii::app()->session['user_id']; if ($session_id == "") { $this->redirect( array('/employee/site/login'

Send emails as a background process

南楼画角 提交于 2019-12-24 23:19:51
问题 I want to make a newsletter feature in my application. I need to send emails about 5000-6000 after I create a newsletter. When the newsletter is published it will create an email queue which will be stored in the database. Since it requires a lot of time I need to run it in the background. So I made a command to send the mail using YiiMailer and the email queue from the database. My command is working, but it is getting terminated after some time without completing the job. Also I need to run