Jump to content

Search the Community

Showing results for tags 'yii'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 10 results

  1. 1down votefavorite I'm new to Yii, and I'm getting this error "Class 'app\controllers\CActiveDataProvider' not found" while running a widget. This is my code: models/industrial.php: <?php namespace app\models; use yii\db\ActiveRecord; class Industrial extends ActiveRecord { } controllers/IndustrialController.php: <?php namespace app\controllers; use yii\web\Controller; use yii\data\Pagination; use app\models\industrial; class IndustrialController extends Controller { public function actionIndex() { $dataProvider=new CActiveDataProvider('Industrial', array( 'pagination'=>array( 'pageSize'=>20, ), )); $query = industrial::find(); $pagination = new Pagination([ 'defaultPageSize' => 20, 'totalCount' => $query->count(), ]); $industrials = $query->orderBy('Company_Name') ->offset($pagination->offset) ->limit($pagination->limit) ->all(); return $this->render('index', [ 'industrials' => $industrials, 'pagination' => $pagination, 'dataProvider'=>$dataProvider, ]); } } views/industrial/index.php: <?php use yii\helpers\Html; use yii\widgets\LinkPager; ?> <h1>Industrial Companies</h1> <ul> <?php use kartik\export\ExportMenu; use kartik\grid\GridView; $gridColumns = [ ['class' => 'yii\grid\SerialColumn'], 'id', 'name', [ 'attribute'=>'Name', 'label'=>'Name', 'vAlign'=>'middle', 'width'=>'190px', 'value'=>function ($model, $key, $index, $widget) { return Html::a($model->Name, '#', []); }, 'format'=>'raw' ], 'Name', 'Location', 'Telephone', ]; echo ExportMenu::widget([ 'dataProvider' => $dataProvider, 'columns' => $gridColumns, 'fontAwesome' => true, 'dropdownOptions' => [ 'label' => 'Export All', 'class' => 'btn btn-default' ] ]) . "<hr>\n". GridView::widget([ 'dataProvider' => $dataProvider, 'columns' => $gridColumns, 'export' => [ 'fontAwesome' => true, ] ]); $array = (array) $industrials; function build_table($array){ // start table $html = '<table class="altrowstable" id="alternatecolor">'; // header row $html .= '<tr>'; foreach($array[0] as $key=>$value){ $html .= '<th>' . $key . '</th>'; } $html .= '</tr>'; // data rows foreach( $array as $key=>$value){ $html .= '<tr>'; foreach($value as $key2=>$value2){ $html .= '<td>' . $value2 . '</td>'; } $html .= '</tr>'; } // finish table and return it $html .= '</table>'; return $html; } echo build_table($array); ?> <?= LinkPager::widget(['pagination' => $pagination]) ?> I'm getting this error in IndustrialController at $dataProvider=new CActiveDataProvider('Industrial', array( 'pagination'=>array( 'pageSize'=>20, ), )); What is the problem here? Could you please help me?
  2. I come from a .NET world. Now entering these frigid php waters. I found an example that got me a little confused. Of course, I am trying to apply OOP fundamentals to this php code but it doesn't make sense. This is the class i am talking about. <?php namespace app\models; class User extends \yii\base\Object implements \yii\web\IdentityInterface { public $id; public $username; public $password; public $authKey; private static $users = [ '100' => [ 'id' => '100', 'username' => 'admin', 'password' => 'admin', 'authKey' => 'test100key', ], '101' => [ 'id' => '101', 'username' => 'demo', 'password' => 'demo', 'authKey' => 'test101key', ], ]; public static function findIdentity($id) { return isset(self::$users[$id]) ? new static(self::$users[$id]) : null; } public static function findByUsername($username) { foreach (self::$users as $user) { if (strcasecmp($user['username'], $username) === 0) { return new static($user); } } return null; } public function getId() { return $this->id; } public function getAuthKey() { return $this->authKey; } public function validateAuthKey($authKey) { return $this->authKey === $authKey; } public function validatePassword($password) { return $this->password === $password; } } Alright, it's obvious to me that in the method findByIdentity($id) all it's doing is creating a static new instance of User. This is the first thing that caught me off guard. In .net you cannot create an instance of a static class. Now, moving on. in that line return isset(self::$users[$id])? new static(self::$users[$id]) : null; the second thing that intrigues me is the following. Since all you have in that array is a key/value collection.... private static $users = [ '100' => [ 'id' => '100', 'username' => 'admin', 'password' => 'admin', 'authKey' => 'test100key', ], '101' => [ 'id' => '101', 'username' => 'demo', 'password' => 'demo', 'authKey' => 'test101key', ], ]; how does php determine that it has to create an User object? Reflection? Which leads me to the next question.... looking at the class that it inherits from, Object, in the constructor, there's in one parameter which is an array (one of the elements of the array above). public function __construct($config = []) { if (!empty($config)) { Yii::configure($this, $config); } $this->init(); } BUT, this class in its constructor, is calling Yii::configure($this, $config) and in this method, the way I see it, Yii is adding to $this (the Object instance I am assuming, not the User one) the parameters that belong to User. public static function configure($object, $properties) { foreach ($properties as $name => $value) { $object->$name = $value; } return $object; } Seems to me like it's adding parameters dynamically to Object which will be accessed by User via the matching parameters. Makes sense? From my .net standpoint, $this in Object refers to Object instance itself, not to the User instance inheriting from it (like my friend says). I told him that's a violation of basic OOP principles and it's simply impossible. Anyone that could make me understand about this? Thank you.
  3. How to implement jqrelcopy with timepicker (yiibooster)? I writen code like this : <?php $this->widget('ext.jqrelcopy.JQRelcopy',array( 'id' => 'copylink', 'removeText' => 'Remove', 'removeHtmlOptions' => array('style'=>'color:red'), 'options' => array( 'copyClass'=>'newcopy', 'limit'=>3, 'clearInputs'=>true, 'excludeSelector'=>'.skipcopy', // 'append'=>CHtml::tag('span',array('class'=>'hint'),'You can remove this line'), ) )); ?> <div class="control-group "><label class="control-label required">Jam Kerja</label> <div class="controls"> <a id="copylink" href="#" rel=".copy">Tambah Jam Kerja / Shift</a> <div class="row copy"> <?php echo CHtml::label('',''); ?> <?php $this->widget('bootstrap.widgets.TbTimePicker', array( 'name' => 'some_time', 'value' => '00:00', 'htmlOptions'=>array('width'=>'50px'), 'noAppend' => true, // mandatory 'options' => array( 'disableFocus' => true, // mandatory 'showMeridian' => false // irrelevant ), ) ); ?> <?php $this->widget('bootstrap.widgets.TbTimePicker', array( 'name' => 'some_time', 'value' => '00:00', 'noAppend' => true, // mandatory 'options' => array( 'disableFocus' => true, // mandatory 'showMeridian' => false // irrelevant ) ) ); ?> </div> </div> </div> But the result shown like this : The picker cannot flew on field 3. always default field 1.
  4. Hi, This is esai, I’m newbie in PHP .Now I'm learning yii framework..I want to decrease the top margin header in my pdf document ..From my side i made changes in tcpdf extension file...but it didn't take any effect in top margin size. How to change the pdf margin in yii framework . is there any other way to set the top margin header size? I want to change the margin height of only specific pdf document...
  5. I am implementing a form using CActiveForm (Yii) and my database is in MySQL. My requirement is to implement a solution which would enroll and assign my users (candidates, filling the form) with date_of_test and and unique roll_number based on test_locations. I have multiple test_locations and they have specific seating capacity for a day e.g Arizona = 1000, Florida = 200. Now based on the seating capacity i need to assign roll_number (unique) and date_of_test to a candidate, e.g in a candidate table data would something be like: id | roll_number | date_of_test | state | <--- ID is auto incremented by MySQL ----------------------------------------------- 1 | 999 | 11/20/2013 | Arizona ----------------------------------------------- 2 | 50 | 11/20/2013 | Florida ----------------------------------------------- 3 | 1000 | 11/20/2013 | Arizona ----------------------------------------------- 4 | 1001 | 11/21/2013 | Arizona <--- Next Date given to candidate ----------------------------------------------- Test locations are assigned to candidates by application based on their present location i.e if someone is from Arizona state his test location would automatically be selected as Arizona (implemented via simple dependent dropdown). I am finding really hard to implement this logic of assigning roll_number and date_of_test to candidates, as i don't want anyone to have same roll number and anyone given a date_of_test more than the seating capacity of a location. Maybe Yii/PHP/MySQL has some function which i am not aware would assist me in implementing it easily. Thus, requiring assistance.
  6. We are after a reliable, switched on developer to continue development of an existing site based on Yii framework. The site started as a script from Uniprodgy (Fundnation script) and needs more work. If interested please let us know experience etc. Thanks
  7. hello guys i need a suggestion regarding which php framework to use for an ERP Application. We at our company have planned to make a ERP for Hotel. We are planing to cover aspects like - Room Booking, Restaurant, Cafe & Bar, Front Desk, Back Office, Kitchen, Inventory, Payment & Accounts etc.. The application will be installed on local server and work on intranet. Oracle will be used as database. It is suggested by our analysis team that for payment, credit card swipe machine should be there. So the framework that we will choose should be compatible with 3rd party tools or APIs. Since database will be Oracle so framework should also be compatible with Oracle. I have searched the web for the best suited framework. There are the top 3 frameworks- CI, Zend, Yii. I have not worked on any of the above frameworks. Which framework should i use. Plz suggest guys.Thanks.
  8. Hi all, I'm developing a application with the Yii framework, and implemented a record security by adding 3 functions to all models (canIView, canIEdit and canIDelete). All models extend the same basemodel class, and all crud interfaces are simular. For some reason whenever I try to view the cruds of the models "Product" or "Order" I get a white page, and no logs anywhere... Debugging some I can echo lines upto the following line in code echo "before"; $model = Product::model(); echo "after"; Before is shown, but not after. The same code on a different model like "Division" does work... Both models extend the same class (AuditModel) which implements several security functions and populates audit fields etc... Can anyone help me debug this... or give an indication where I can find anything to point me towards any error in the code... Yii application log is empty Apache log is empty Thx
  9. Amigos, Coming from desktop applications environment, I have been playing around with PHP for months now, I am so comfortable with it. I understood that frameworks should help me do many things better and faster; I see the benefit, however once I start learning it, I get many problems as I can not see the real base logic behind it and I get lost easily. It seems to me that it is easier to build from the zero in pure PHP, rather than learning a framework, which I can not understand totally. Yii was my choice.. I don't think it has anything to do with the specific choice... Any advice? Did I have a wrong approach ?? Advices about good resources to start with it??? or may be I should just keep it with pure PHP?!??
  10. I am trying to set up yii. I have it installed and running on Ubuntu 13.10. I have googled and searched to find why it cannot connect to a MySQL db and can't find a fix. I have MySQL in my php ini file with pdo, checked passwords/users and checked the requirements page. I've changed the main.php (several times) and console.php. Using PHP 5.3.3, MySql 5.5.3. Everything seems to be correct but obviously not. Anyone have any suggestions?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.