I searched here, but couldn't find solution to my problem.
I was trying to use the example code, Simple Subgrid worked fine.
However, Subgrid 2 Level is not working.
displaygrid.php contains:
$grid->setSubGridGrid("displaysubgrid.php");
when I try to have the following code in displaysubgrid.php
$grid->querySubGrid(array(&$rowid));
I get output like
{"rows":[{"stockNumber":"LOT1","stock":"5","expiration":"2013-01-01"}]}
Which means data passing is okay. However, when I try to use the following
$subtable = $subtable."_t";
$pager = $subtable."_p";
$grid->renderGrid($subtable,$pager, true, null, array(&$rowid), true,true);
it's showing empty grid!
Related
I'm using the PHP V2 API. I requested full access (scope: https://www.googleapis.com/auth/drive). I also tried adding all of the different scopes to no avail.
I'm fully able to retrieve all files and list them but the thumbnail link is always null. Same with 'hasThumbnail'.
I tried the API explorer on https://developers.google.com/drive/v2/reference/files/get#examples and it shows me the thumbnail links correctly.
The relevant code can be boiled down to this:
$drive = new Google_Service_Drive($this->client);;
$files = $drive->files->listFiles($parameters)->files;
This is the response from the API explorer.
The response from my code (for the same ID) is:
Found the solution. It took 5 hours to run into this such simple solution.
Not many fields show by default, you must specify which fields you want populated.
The modified basic query now is:
$this->drive->files->listFiles([
'fields' => 'nextPageToken, files(thumbnailLink, webViewLink)'
])->files;
This is my url after I done my filtering.
http://localhost/VMS/frontend/web/index.php?r=report%2Ffilter&ic_passport=&name=&unit_no=&category=4&purpose=
1) I tried to get the param inside the url
$category = Yii::$app->getRequest()->getQueryParam('category');
Yii::$app->request->getParam('category');
Yii::$app->request->get('category');
but it does not works. Anything I done wrong?
2)Let say I wanted to do query based on the URL so that I can only export out the result that only been filter
`Table1::find()
->andwhere(['category_id'=>$category])
->andWhere(['visitor_name'=>$visitor_name])
->andWhere(['ic'=>$ic_passport])
->andWhere(['unit_no'=>$unit_no])
->andWhere(['purpose_id'=>$purpose])
->all(),`
Based on the filter url, it will come out result that have category 4. But when I used my own created query, it will come out 0 result because other attribute is blank. Why in the url the attribute can be leave blank and it works but in the query it cant?
UPDATED SOLUTION:
`Table1::find()
->andFilterwhere(['category_id'=>$category])
->andFilterWhere(['visitor_name'=>$visitor_name])
->andFilterWhere(['ic'=>$ic_passport])
->andFilterWhere(['unit_no'=>$unit_no])
->andFilterWhere(['purpose_id'=>$purpose])
->all()`
Just use ->andFilterWhere.
1) get() and getQueryParam() should definitely work (first one is basically alias for the second) - if it's not working you must do something wrong.
2) Use andFilterWhere() instead of andWhere() - it works the same way but if variable in condition is empty it's ignored.
I'm trying to do a pagination in the website I'm developing. I found that Propel has a paginate() method that is useful for doing this but I cannot make it work.
Here's some code:
$pager = ElementQuery::create()->paginate($page = 1, $maxPerPage = 10);
$pager should have the following methods, by Propel's official documentation:
$pager->getNbResults(); // total number of results if not paginated
$pager->haveToPaginate(); // return true if the total number of results exceeds the maximum per page
$pager->getFirstIndex(); // index of the first result in the page
$pager->getLastIndex(); // index of the last result in the page
And I should be able to do something like this:
$links = $pager->getLinks(5);
But I'm just getting Element class methods.
Am I missing something?
Here's where I got that information about pagination (to find it fast press Ctrl + F and type paginate())
Thanks.
If you let me auto-answer my question... It seems those methods I mentioned are there, but for some reason they don't appear on my Netbeans editor when I write $pager->
I don't know if this counts as an answer but the "problem" is "solved"...
I'm trying to perform a mass assignment of 2 variables I'm sending via GET to another model::controller (from project::actionCreate to client::actionCreate)
In the _form view for project::actionCreate I've got the following:
<?php echo " ".Chtml::link('+New client',array('client/create',array('Client' => array('redir'=>Yii::app()->controller->route,'redirId'=>$model->id))));?>
With the goal of creating an array "Client" with attributes "redir" and "redirId".
In client::actionCreate I want to do something like
if(isset($_GET['Client']))
{
$model->attributes=$_GET['Client'];
}
Now I noticed that my $_GET var puts client inside subarray 0, so I've tried this with
$_GET[0]['Client']
as well, but no luck. However if I manually assign the variables like this:
$model->redir = $_GET[0]['Client']['redir'];
$model->redirId = $_GET[0]['Client']['redirId'];
Then it works.
Any idea what is up? The goal is to allow someone to create a new client while creating/updating a project record, by sending them to client::actionCreate, but redirecting them back to their original project::actionCreate if they were linked there from my "+New Client" link.
I think the client array is put inside subarray 0 because you've added an array around the parameters. Try removing the array like the following:
<?php
Chtml::link('+New client',array('client/create', 'Client' => array('redir'=>Yii::app()->controller->route,'redirId'=>$model->id)));
?>
I don't know what your model looks like but if the fields aren't assigned they are probably not safe. You can make them safe by adding them to the rules part of your model. Or you could try the following, by specifying the false parameter it will be possible to assign values to unsafe attributes. (http://www.yiiframework.com/doc/api/1.1/CModel#setAttributes-detail)
$model->setAttributes($_GET['Client'], false);
I am not sure creating a link like you want is possible. I have asked something similar some time ago Yii link with [ as a parameter I just could never get the link to how I wanted it. In the end I just created the link the old fashion way, not using CHTML.
'm using GAPI version 1.3 I have added a custom variable in GA code like this:
**_gaq.push(['_setCustomVar', 1, 'Member', '<?php echo $member_id; ?>, 3]);**
And its working fine..
Now I need to fetch the data from GA: so my request to GA is like this:
**https://www.google.com/analytics/feeds/data?
ids=XXXXXXXXXXX&
dimensions=ga:customVarValue1,ga:pagePath&
metrics=ga:pageviews,ga:uniquePageviews,ga:bounces,ga:exits&
filters=ga:pagePath=#event_details.php;ga:customVarValue1=2004036442&
start-date=2011-04-20&
end-date=2011-05-04&
max-results=50**
I need to fetch data from GA where pagePath=#event_details.php AND ga:customVarValue1=2004036442
But this is not resulting anything...
When I changed the filters in the following why its resulting all the pagePath = event_details.php and its working fine.. filters=ga:pagePath=#event_details.php
But I need get the page path with the particular member ID that is why I used the condition as below: filters=ga:pagePath=#event_details.php;ga:customVarValue1=2004036442&
So any one have idea about this?? Please help..
After looking at the code you posted in Google Docs, I see your problem.
Try using this as your filter.
$filter = 'pagePath =# ' . $filter_text[$tab] . ' && customVarValue1 == 2004036442'
The function you are passing $filter to does a cleanup process that escapes any reserved characters with a backslash. Your customVariable is being sent with a slash at the end, which is why it's not returning any matches.