Re: Cakephp CLI error

2013-11-21 Thread Victor Musvibe
Solution is C:\wamp\www\myaapname\app>cake [command]

I was in a wrong folder, u dont need to call console


Sent from Samsung Mobile

 Original message 
From: Leandro Machado Pereira  
Date:  
To: cake-php@googlegroups.com 
Subject: Re: Cakephp CLI error 
 
Try



cd /path/to/cakephp/app
call console\cake bake all


2013/11/20 David Rochelet 
Hi,

Seems you didn't configure your database.
Try this : 
http://book.cakephp.org/2.0/fr/console-and-shells/code-generation-with-bake.html

It is mentionned that you have first to create a  database.php file.

David


2013/11/20 Victor Musvibe 
I am using cakephp 2.x and im trying Code Generation with Bake. When i try to 
cake bake all. Below are the errors i am getting in command line. 

I have posted this question on 
http://stackoverflow.com/questions/20079795/cakephp-cli-error , im just hoping 
to get a quicker response here.

I am using cakephp 2.x and im trying Code Generation with Bake. When i try to 
cake bake all. Below are the errors i am getting in command line. 

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\victorm>cd c:\wamp\www\myappname\app\Console

c:\wamp\www\myappname\app\Console>cake bake all


Welcome to CakePHP v2.4.2 Console
---
App : Console
Path: c:\wamp\www\myappname\app\Console\
---
Bake All
---
Warning Error: 
include_once(c:\wamp\www\myappname\app\Console\Config\database.php): failed to 
open stream: No such file or directory in 
[C:\wamp\www\myappname\lib\Cake\Model\ConnectionManager.php, line 69]

Warning Error: include_once(): Failed opening 
'c:\wamp\www\myappname\app\Console\Config\database.php' for inclusion 
(include_path='C:\wamp\www\myappname\lib;.;C:\php5\pear') in 
[C:\wamp\www\myappname\lib\Cake\Model\ConnectionManager.php, line 69]

Error: The datasource configuration "default" was not found in 
database.php
#0 C:\wamp\www\myappname\lib\Cake\Model\ConnectionManager.php(93): 
Connection
Manager::_getConnectionObject('default')
#1 
C:\wamp\www\myappname\lib\Cake\Console\Command\Task\ModelTask.php(929): 
ConnectionManager::getDataSource('default')
#2 
C:\wamp\www\myappname\lib\Cake\Console\Command\Task\ModelTask.php(866): 
ModelTask->getAllTables('default')
#3 
C:\wamp\www\myappname\lib\Cake\Console\Command\Task\ModelTask.php(955): 
ModelTask->listAll('default')
#4 C:\wamp\www\myappname\lib\Cake\Console\Command\BakeShell.php(152): 
ModelTask->getName('default')
#5 C:\wamp\www\myappname\lib\Cake\Console\Shell.php(433): 
BakeShell->all()
#6 C:\wamp\www\myappname\lib\Cake\Console\ShellDispatcher.php(209): 
Shell->runCommand('all', Array)
#7 C:\wamp\www\myappname\lib\Cake\Console\ShellDispatcher.php(68): 
ShellDispatcher->dispatch()
#8 C:\wamp\www\myappname\app\Console\cake.php(37): 
ShellDispatcher::run(Array)
#9 {main}


c:\wamp\www\myappname\app\Console>

Does anyone have an idea on how to fix this?
-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.



-- 
David ROCHELET
Tel.  +33(0)6 31 04 70 83
-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.



-- 
***Se você pretende redirecionar este e-mail, por favor, apague todos os 
endereços que aparecem nele. Outra dica de segurança é endereçá-lo no Cco. 
Desta forma você estará protegendo a mim, seus amigos e a você mesmo. Eu e a 
Campanha Contra o SPAM agradecemos.Não envie correntes.***
-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
--- 
You received this message because you are subscribed to a topic in the Google 
Group

Cakephp CLI error

2013-11-19 Thread Victor Musvibe
I am using cakephp 2.x and im trying Code Generation with Bake. When i try 
to cake bake all. Below are the errors i am getting in command line. 

I have posted this question on 
http://stackoverflow.com/questions/20079795/cakephp-cli-error , im just 
hoping to get a quicker response here.

I am using cakephp 2.x and im trying Code Generation with Bake. When i try 
to cake bake all. Below are the errors i am getting in command line. 
 *Microsoft Windows [Version 6.1.7601]*
* Copyright (c) 2009 Microsoft Corporation.  All rights reserved.*

* C:\Users\victorm>cd c:\wamp\www\myappname\app\Console*

* c:\wamp\www\myappname\app\Console>cake bake all*


* Welcome to CakePHP v2.4.2 Console*
*---*
* App : Console*
* Path: c:\wamp\www\myappname\app\Console\*
*---*
* Bake All*
*---*
* Warning Error: 
include_once(c:\wamp\www\myappname\app\Console\Config\database.php): failed 
to open stream: No such file or directory in 
[C:\wamp\www\myappname\lib\Cake\Model\ConnectionManager.php, line 69]*

* Warning Error: include_once(): Failed opening 
'c:\wamp\www\myappname\app\Console\Config\database.php' for inclusion 
(include_path='C:\wamp\www\myappname\lib;.;C:\php5\pear') in 
[C:\wamp\www\myappname\lib\Cake\Model\ConnectionManager.php, line 69]*

* Error: The datasource configuration "default" was not found in 
database.php*
* #0 C:\wamp\www\myappname\lib\Cake\Model\ConnectionManager.php(93): 
Connection*
* Manager::_getConnectionObject('default')*
* #1 
C:\wamp\www\myappname\lib\Cake\Console\Command\Task\ModelTask.php(929): 
ConnectionManager::getDataSource('default')*
* #2 
C:\wamp\www\myappname\lib\Cake\Console\Command\Task\ModelTask.php(866): 
ModelTask->getAllTables('default')*
* #3 
C:\wamp\www\myappname\lib\Cake\Console\Command\Task\ModelTask.php(955): 
ModelTask->listAll('default')*
* #4 C:\wamp\www\myappname\lib\Cake\Console\Command\BakeShell.php(152): 
ModelTask->getName('default')*
* #5 C:\wamp\www\myappname\lib\Cake\Console\Shell.php(433): 
BakeShell->all()*
* #6 C:\wamp\www\myappname\lib\Cake\Console\ShellDispatcher.php(209): 
Shell->runCommand('all', Array)*
* #7 C:\wamp\www\myappname\lib\Cake\Console\ShellDispatcher.php(68): 
ShellDispatcher->dispatch()*
* #8 C:\wamp\www\myappname\app\Console\cake.php(37): 
ShellDispatcher::run(Array)*
* #9 {main}*


* c:\wamp\www\myappname\app\Console>*

Does anyone have an idea on how to fix this?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


CakePHP bake command not working in CLI

2013-09-30 Thread Victor Musvibe


I have got an application that i am working on built using Cakephp 1.3 
problem that i am having is that i am failing to bake using CLI. I am using 
Windows 7 and xampp as my localserver. This is how i have added my 
Environment Variables.

C:\xampp\php;C:\xampp\htdocs\myappname\cake\console\

When i type cake command in the CLI i get an error 'cake' is not recognized 
as an internal or external command, operable program or batch file.

Does anyone have an idea on how to fix this.

I have also asked the same question on SO and i dont seem to get answer - 
http://stackoverflow.com/questions/19094349/cakephp-bake-command-not-working-in-cli
 

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Writing data into a new worksheet using PHPExcel in Cakephp

2013-03-27 Thread Victor Musvibe
I am using PHPExcel to generate reports for my application in cakephp.  The 
first worksheet is perfectly done but when I want to write on the same 
workbook different new worksheet, phpexcel just creates the worksheet but 
does not post data. For example record with id = 1 shows on its worksheet 
and id =2 shows on its worksheet...etc

Here is my code for my addsheet that inserts a new tab

/**
* Create new worksheet
*/
public function createWorksheet() {
$this->loadEssentials();
$this->xls = new PHPExcel();
}

public function addSheet($tab) {
$newWorksheet = new PHPExcel_Worksheet($this->xls, $tab);
$this->xls->addSheet($newWorksheet);
}

//other code

and here is my view for the worksheet

PhpExcel->createWorksheet();
$this->PhpExcel->setDefaultFont('Calibri', 12);

// define table cells
$table = array(
array('label' => __('id'), 'width' => 'auto', 'filter' => true),
array('label' => __('name'), 'width' => 'auto', 'filter' => true),
array('label' => __('type'), 'width' => 'auto', 'filter' => true),
array('label' => __('comment'), 'width' => 'auto', 'filter' => true),
array('label' => __('status type'), 'width' => 'auto', 'filter' => 
true),
array('label' => __('created'), 'width' => 'auto', 'filter' => true),
);

// heading
$this->PhpExcel->addTableHeader($table, array('name' => 'Cambria', 
'bold' => true));

foreach ($itQueries as $d) {
$this->PhpExcel->addSheet($d['ItQuery']['id']);
$this->PhpExcel->addTableRow(array(
$d['ItQuery']['id'],
$d['ItQuery']['hr_employee_id'],
$d['ItQuery']['it_query_type_id'],
$d['ItQuery']['comment'],
$d['ItQuery']['status_type'],
$d['ItQuery']['created'],
));
}

$this->PhpExcel->addTableFooter();
$this->PhpExcel->output();
$this->PhpExcel->exit();
?>

Its my first time using the helper

I have posted this question on OS as well, hoping to get a quick response 
on this group - 
http://stackoverflow.com/questions/15501509/writing-data-into-a-new-worksheet-using-phpexcel-in-cakephp
  


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Multiple excel sheet download

2013-03-19 Thread Victor Musvibe
Hi Cricket

Did you manage to have records opening in different tabs?

On Thursday, 25 November 2010 18:08:47 UTC+2, the plumpNation wrote:
>
> Hi guys, 
>
> I have a sales report in excel which is generated using cakephp and 
> PHPExcel. I am very happy with both of these frameworks/libraries. I 
> am really starting to feel very comfortable using them both and am 
> finally getting to the stage of being able to 'rapidly develop', the 
> whole point of cake. 
>
> Currently, the sales are generated from customers who share 
> distributors. So the logic goes 
>
> foreach(distributor){ 
>// create excel of sales using this distributor; 
>// send email with sales to this distributor; 
> } 
>
> Then I added functionality to allow the sales manager to download the 
> sheet just to check it, before the cron ran and sent it to the 
> distributors. 
>
> foreach(distributor){ 
>// create excel of sales using this distributor; 
>   if(!browserOutput){ 
>// send email with sales to this distributor; 
>   }else{ 
>   // output the excel sheet to the browser; 
>   } 
> } 
>
> Now it all works fine except that I only receive the first sheet, 
> probably because you can't do a looping download. I was just wondering 
> if anyone had an elegant solution to this that didn't involve me 
> writing the sheets to different tabs in the same excel sheet, but 
> allows the manager to receive all the sheets from the browser one at a 
> time. Maybe opening the output in different tabs or windows might 
> work, but not sure how to do this. At the moment I set headers to the 
> correct mime type like so 
>
> if($browserOutput){ 
>
> $message .= 'for output to browser'; 
> header( 'Content-Type: 
> application/vnd.ms-excel' ); 
> header( 'Content-Disposition: 
> attachment;filename="' . $filename . 
> '"'); 
> header( 'Cache-Control: max-age=0' ); 
>
> } 
>
> and then use PHPExcel like so 
>
> $thisSheet->save('php://output'); 
>
> Whatcha fink? Is this possible or should I write all the sheets into 
> one file to download? 
>
> Cheers for reading

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to hide id input and give it a value in cakephp

2013-03-07 Thread Victor Musvibe
Thanks will keep that in mind next time i post a question

On Thu, Mar 7, 2013 at 2:35 PM, euromark  wrote:

> If you feel the need to crosspost all over the www, it would be nice to
> link those other posts - like
>
> http://stackoverflow.com/questions/15269787/how-to-hide-id-input-and-give-it-a-value-in-cakephp
>
> this way people can take a look there if the answer might already be
> answered and avoid giving the exact same answer again
>
>
>
> Am Donnerstag, 7. März 2013 12:59:05 UTC+1 schrieb Victor Musvibe:
>
>> I have 2 models that are related and what i would like to do is in my add
>> view i would like to set the id field as a hidden field so that it doesnt
>> show on my add view, when i set it to hidden the form doesn't submit. Is
>> there a way of passing the id value as a hidden field?
>>
>> here is my add view
>>
>> Form->create('**ItQueryComment'); ?>
>> 
>> > echo $this->Form->hidden('it_query_**id');
>> echo $this->Form->input('comment');
>> ?>
>>
>> Form->end(__('Submit'))**; ?>
>>
>> and here is add function for the ItQueries Controller
>>
>> public function add() {
>> if ($this->request->is('post')) {
>> $this->ItQuery->create();
>> if ($this->ItQuery->save($this->**request->data)) {
>> $this->Session->setFlash(__('**The it query has been saved'));
>> $this->redirect(array('action' => 'index'));
>> } else {
>> $this->Session->setFlash(__('**The it query could not be saved.
>> Please, try again.'));
>> }
>> }
>> $itQueryTypes = $this->ItQuery->ItQueryType->**find('list');
>> $this->set(compact('**itQueryTypes'));
>> }
>>
>> Thank you in advance
>>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "CakePHP" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/cake-php/P8fdBapI_1c/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




How to hide id input and give it a value in cakephp

2013-03-07 Thread Victor Musvibe
I have 2 models that are related and what i would like to do is in my add 
view i would like to set the id field as a hidden field so that it doesnt 
show on my add view, when i set it to hidden the form doesn't submit. Is 
there a way of passing the id value as a hidden field?

here is my add view

Form->create('ItQueryComment'); ?>

Form->hidden('it_query_id');
echo $this->Form->input('comment');
?>

Form->end(__('Submit')); ?>

and here is add function for the ItQueries Controller

public function add() {
if ($this->request->is('post')) {
$this->ItQuery->create();
if ($this->ItQuery->save($this->request->data)) {
$this->Session->setFlash(__('The it query has been saved'));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The it query could not be saved. Please, 
try again.'));
}
}
$itQueryTypes = $this->ItQuery->ItQueryType->find('list');
$this->set(compact('itQueryTypes'));
}

Thank you in advance

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Redirecting to a different controller view in Cakephp

2013-03-07 Thread Victor Musvibe
Hi

I solved it by doing this
$this->request->data['ItQueryComment']['it_query_id']

On Thu, Mar 7, 2013 at 1:42 PM, Jerome Walitzek  wrote:

> Hi,
>
> i solve the problem with following
>
> $this->redirect(array('controller' =>
> 'posts', 'action'=>'view',$this->Post->id));
>
>
>
> Am Donnerstag, 7. März 2013 11:32:47 UTC+1 schrieb Victor Musvibe:
>
>> I have to 2 models that are related ItQuery and ItQueryComment. When a
>> user adds a ItQuery other users should be able to comment on it. What i am
>> trying to achieve is when other users add comments on a query they should
>> be redirect to the view of the query not the index page for the
>> it_query_comments
>>
>> here is my code for my comments add view
>>
>> Form->create('**ItQueryComment'); ?>
>> 
>> 
>> > echo $this->Form->input('it_query_**id');
>> echo $this->Form->input('comment');
>> ?>
>> 
>> Form->end(__('Submit'))**; ?>
>>
>> and here is my add function in the controller
>>
>> public function add() {
>> if ($this->request->is('post')) {
>> $this->ItQueryComment->create(**);
>> if ($this->ItQueryComment->save($**this->request->data)) {
>> $this->Session->setFlash(__('**The it query comment has been
>> saved'));
>> $this->redirect(array('**controller' => 'it_queries','action' =>
>> 'view', $itQuery['ItQuery']['id']));
>> } else {
>> $this->Session->setFlash(__('**The it query comment could not be
>> saved. Please, try again.'));
>> }
>> }
>> $itQueries = $this->ItQueryComment->**ItQuery->find('list');
>> $this->set(compact('itQueries'**));
>> }
>>
>> If anyone could show me how to do this, that would be awesome. Thanks in
>> advance
>>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "CakePHP" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/cake-php/1DwOvt-0Ncw/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Redirecting to a different controller view in Cakephp

2013-03-07 Thread Victor Musvibe
I have to 2 models that are related ItQuery and ItQueryComment. When a user 
adds a ItQuery other users should be able to comment on it. What i am 
trying to achieve is when other users add comments on a query they should 
be redirect to the view of the query not the index page for the 
it_query_comments

here is my code for my comments add view 

Form->create('ItQueryComment'); ?>


Form->input('it_query_id');
echo $this->Form->input('comment');
?>

Form->end(__('Submit')); ?>

and here is my add function in the controller

public function add() {
if ($this->request->is('post')) {
$this->ItQueryComment->create();
if ($this->ItQueryComment->save($this->request->data)) {
$this->Session->setFlash(__('The it query comment has been saved'));
$this->redirect(array('controller' => 'it_queries','action' => 'view', 
$itQuery['ItQuery']['id']));
} else {
$this->Session->setFlash(__('The it query comment could not be saved. 
Please, try again.'));
}
}
$itQueries = $this->ItQueryComment->ItQuery->find('list');
$this->set(compact('itQueries'));
}

If anyone could show me how to do this, that would be awesome. Thanks in 
advance

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to define a checkbox variable in Cakephp

2013-03-06 Thread Victor Musvibe
Thanks euromark. I am on it

On Wed, Mar 6, 2013 at 10:34 AM, euromark  wrote:

> You already got your answer at SO.
>
> Am Mittwoch, 6. März 2013 08:50:35 UTC+1 schrieb Victor Musvibe:
>
>> I have a form in my Plugin elements and what i would like to insert the
>> checkbox value into a table named it_queries and field status_type and its
>> giving me an error  Undefined variable: variableValue
>> [APP\Plugin\Feedback\View\**Elements\comment_add.ctp, line 37] .I have
>> declared the variable in my controller like this
>>
>> $this->set('**variableValueStatus', 'Pending');
>>
>> and this is line 37 thats giving me the error
>>
>> Below is the Controller code
>>
>> class CommentsController extends FeedbackAppController
>> {
>> public $components = array('Feedback.Comments');
>>
>> public function add($foreign_model = null, $foreign_id = null)
>> {
>> if (empty($foreign_model) ||
>> empty($foreign_id) ||
>> !$this->request->is('post')
>> )
>> {
>> $this->set('**variableValueStatus', 'Pending');
>> return $this->redirect('/');
>> }
>> //Other code
>>
>> }
>>
>> and in the add view in my element here is how i am trying to accessing
>> the variable value
>>
>> echo $this->Form->checkbox('**ItQuery.status_type', array('type' =>
>> 'hidden', 'value'=>$variableValueStatus)**);
>>
>> If someone can show me how to fix this, that would be awesome
>>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "CakePHP" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/cake-php/NzYQtYu1Jms/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




How to define a checkbox variable in Cakephp

2013-03-05 Thread Victor Musvibe
I have a form in my Plugin elements and what i would like to insert the 
checkbox value into a table named it_queries and field status_type and its 
giving me an error  Undefined variable: variableValue 
[APP\Plugin\Feedback\View\Elements\comment_add.ctp, line 37] .I have 
declared the variable in my controller like this 

$this->set('variableValueStatus', 'Pending');

and this is line 37 thats giving me the error

Below is the Controller code

class CommentsController extends FeedbackAppController
{
public $components = array('Feedback.Comments');

public function add($foreign_model = null, $foreign_id = null)
{
if (empty($foreign_model) ||
empty($foreign_id) ||
!$this->request->is('post')
)
{
$this->set('variableValueStatus', 'Pending');
return $this->redirect('/');
}
//Other code

}

and in the add view in my element here is how i am trying to accessing the 
variable value

echo $this->Form->checkbox('ItQuery.status_type', array('type' => 
'hidden', 'value'=>$variableValueStatus));

If someone can show me how to fix this, that would be awesome

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




How to insert a checkbox value into a table from plugin in Cakephp

2013-03-05 Thread Victor Musvibe
I am using a feedback plugin for my app and on the add view i am putting a 
checkbox with value Pending. I was wondering if they is a away that when 
the checkbox is ticket it will insert the checkbox value into a table named 
it_queries and field name status_type.

Here is how i am declaring my variable name in the plugin controller

$this->set('variableValueStatus', 'Pending');

and here is the Plugin controller code

set('variableValueStatus', 'Pending');
if (empty($foreign_model) ||
empty($foreign_id) ||
!$this->request->is('post')
)
{
return $this->redirect('/');
}

App::uses($foreign_model, 'Model');
$Model = ClassRegistry::init($foreign_model);

if (!($Model instanceof Model))
{
return $this->redirect('/');
}

if ($Model->hasAny(array($Model->primaryKey => $foreign_id)) == false)
{
return $this->redirect('/');
}

if (!isset($this->request->data['Comment']['foreign_model']) ||
!isset($this->request->data['Comment']['foreign_id']) ||
$this->request->data['Comment']['foreign_model'] != $foreign_model ||
$this->request->data['Comment']['foreign_id'] != $foreign_id)
{
return $this->redirect('/');
}

$user_id = null;

if (isset($this->Auth))
{
$user_id = $this->Auth->user('id');
}

$this->request->data['Comment']['foreign_model'] = $Model->name;
$this->request->data['Comment']['foreign_id'] = $foreign_id;
$this->request->data['Comment']['user_id'] = $user_id;
$this->request->data['Comment']['author_ip'] = 
$this->request->clientIp();

$this->Comment->create();

if (!$this->Comment->save($this->request->data))
{
$this->set('validation_errors', $this->Comment->validationErrors);
return;
}


$this->redirect($this->request->referer().'#comment-'.$this->Comment->id);
}
}

and here is my code for the checkbox in the plugin add view

Form->checkbox('ItQuery.status_type', array('type' => 
'hidden', 'value'=>$variableValueStatus)); ?>

Can some please show me how to fix this

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to define a variable in Cakephp

2013-03-05 Thread Victor Musvibe
Yes you right. I have removed public $variableValue = 'Open'; and did
exactly what you did

On Tue, Mar 5, 2013 at 2:12 PM, Jeremy Burns | Class Outfit <
jeremybu...@classoutfit.com> wrote:

> I'm pleased it works, but I'm confused why you need this line:
>
> public $variableValue = 'Open';
>
> Why not just do this:
>
> $this->set('variableValue', 'Open');
>
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com
>
> On 5 Mar 2013, at 12:08:43, Victor Musvibe  wrote:
>
> Thank you, now it works. What i did was in my controller i put this line
>
> public $variableValue = 'Open';
>
> Then in my add function
>
>  $this->set('variableValue', $this->variableValue);
>
> And lastly in my add view
>
> echo $this->Form->input('status_type', array('type' => 'hidden',
> 'value'=>$variableValue));
>
> Hope this will help out someone with the same challenge
>
> On Tue, Mar 5, 2013 at 1:08 PM, Jeremy Burns | Class Outfit <
> jeremybu...@classoutfit.com> wrote:
>
>> Correction (sorry):
>>
>> Then in your view you can refer to *$myVariableName*.
>>
>> Jeremy Burns
>> Class Outfit
>>
>> http://www.classoutfit.com
>>
>> On 5 Mar 2013, at 11:03:15, Jeremy Burns | Class Outfit <
>> jeremybu...@classoutfit.com> wrote:
>>
>> To pass a variable through to a view, simply do this in your controller
>> function:
>>
>> $this->set('myVariableName', $variableValue);
>>
>> Then in your view you can refer to $variableValue.
>>
>> Jeremy Burns
>> Class Outfit
>>
>> http://www.classoutfit.com
>>
>> On 5 Mar 2013, at 10:59:50, Victor Musvibe  wrote:
>>
>> Hi Euromark
>>
>> I am the one who posted that. Was hoping to get a quicker response on the
>> cakephp group
>>
>> On Tue, Mar 5, 2013 at 12:57 PM, euromark  wrote:
>>
>>>
>>> http://stackoverflow.com/questions/15221467/how-to-define-a-variable-in-cakephp
>>>
>>>
>>> Am Dienstag, 5. März 2013 11:55:37 UTC+1 schrieb Victor Musvibe:
>>>
>>>> I trying to pass a variable in cakephp to a view and getting error
>>>> Undefined variable: view [APP\View\ItQueries\add.ctp, line 9] and line 9 is
>>>> this
>>>>
>>>> Form->hidden('status_**type',
>>>> array('value'=>$view)); ?>
>>>>
>>>> Here is how im defining my variable in the controller
>>>>
>>>> class ItQueriesController extends AppController {
>>>>
>>>> var $view = 'Open';
>>>>
>>>> public function index() {
>>>> $this->ItQuery->recursive = 0;
>>>> $this->set('view', $this->view);
>>>>
>>>> }
>>>>
>>>> //Other Code
>>>>
>>>> }
>>>>
>>>> and here is where im trying to pass the variable as a hidden field
>>>>
>>>> Form->create('ItQuery')**; ?>
>>>> 
>>>> >>> echo $this->Form->input('status_**type', array('type' => 'hidden',
>>>> 'value'=>$view));
>>>> ?>
>>>> Form->end(__('Submit'))**; ?>
>>>>
>>>> Can some please show me how to fix this
>>>>
>>>>
>>> --
>>> Like Us on FaceBook https://www.facebook.com/CakePHP
>>> Find us on Twitter http://twitter.com/CakePHP
>>>
>>> ---
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "CakePHP" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/cake-php/T5fDJXZAHwY/unsubscribe?hl=en
>>> .
>>> To unsubscribe from this group and all its topics, send an email to
>>> cake-php+unsubscr...@googlegroups.com.
>>> To post to this group, send email to cake-php@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>
>> --
>> Like Us on FaceBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>
>> ---
>> You received this messag

Re: How to define a variable in Cakephp

2013-03-05 Thread Victor Musvibe
Thank you, now it works. What i did was in my controller i put this line

public $variableValue = 'Open';

Then in my add function

 $this->set('variableValue', $this->variableValue);

And lastly in my add view

echo $this->Form->input('status_type', array('type' => 'hidden',
'value'=>$variableValue));

Hope this will help out someone with the same challenge

On Tue, Mar 5, 2013 at 1:08 PM, Jeremy Burns | Class Outfit <
jeremybu...@classoutfit.com> wrote:

> Correction (sorry):
>
> Then in your view you can refer to *$myVariableName*.
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com
>
> On 5 Mar 2013, at 11:03:15, Jeremy Burns | Class Outfit <
> jeremybu...@classoutfit.com> wrote:
>
> To pass a variable through to a view, simply do this in your controller
> function:
>
> $this->set('myVariableName', $variableValue);
>
> Then in your view you can refer to $variableValue.
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com
>
> On 5 Mar 2013, at 10:59:50, Victor Musvibe  wrote:
>
> Hi Euromark
>
> I am the one who posted that. Was hoping to get a quicker response on the
> cakephp group
>
> On Tue, Mar 5, 2013 at 12:57 PM, euromark  wrote:
>
>>
>> http://stackoverflow.com/questions/15221467/how-to-define-a-variable-in-cakephp
>>
>>
>> Am Dienstag, 5. März 2013 11:55:37 UTC+1 schrieb Victor Musvibe:
>>
>>> I trying to pass a variable in cakephp to a view and getting error
>>> Undefined variable: view [APP\View\ItQueries\add.ctp, line 9] and line 9 is
>>> this
>>>
>>> Form->hidden('status_**type',
>>> array('value'=>$view)); ?>
>>>
>>> Here is how im defining my variable in the controller
>>>
>>> class ItQueriesController extends AppController {
>>>
>>> var $view = 'Open';
>>>
>>> public function index() {
>>> $this->ItQuery->recursive = 0;
>>> $this->set('view', $this->view);
>>>
>>> }
>>>
>>> //Other Code
>>>
>>> }
>>>
>>> and here is where im trying to pass the variable as a hidden field
>>>
>>> Form->create('ItQuery')**; ?>
>>> 
>>> >> echo $this->Form->input('status_**type', array('type' => 'hidden',
>>> 'value'=>$view));
>>> ?>
>>> Form->end(__('Submit'))**; ?>
>>>
>>> Can some please show me how to fix this
>>>
>>>
>> --
>> Like Us on FaceBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "CakePHP" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/cake-php/T5fDJXZAHwY/unsubscribe?hl=en.
>> To unsubscribe from this group and all its topics, send an email to
>> cake-php+unsubscr...@googlegroups.com.
>> To post to this group, send email to cake-php@googlegroups.com.
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
>  --
> Like Us on FaceBook http

Re: How to define a variable in Cakephp

2013-03-05 Thread Victor Musvibe
Hi Euromark

I am the one who posted that. Was hoping to get a quicker response on the
cakephp group

On Tue, Mar 5, 2013 at 12:57 PM, euromark  wrote:

>
> http://stackoverflow.com/questions/15221467/how-to-define-a-variable-in-cakephp
>
>
> Am Dienstag, 5. März 2013 11:55:37 UTC+1 schrieb Victor Musvibe:
>
>> I trying to pass a variable in cakephp to a view and getting error
>> Undefined variable: view [APP\View\ItQueries\add.ctp, line 9] and line 9 is
>> this
>>
>> Form->hidden('status_**type',
>> array('value'=>$view)); ?>
>>
>> Here is how im defining my variable in the controller
>>
>> class ItQueriesController extends AppController {
>>
>> var $view = 'Open';
>>
>> public function index() {
>> $this->ItQuery->recursive = 0;
>> $this->set('view', $this->view);
>>
>> }
>>
>> //Other Code
>>
>> }
>>
>> and here is where im trying to pass the variable as a hidden field
>>
>> Form->create('ItQuery')**; ?>
>> 
>> > echo $this->Form->input('status_**type', array('type' => 'hidden',
>> 'value'=>$view));
>> ?>
>> Form->end(__('Submit'))**; ?>
>>
>> Can some please show me how to fix this
>>
>>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "CakePHP" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/cake-php/T5fDJXZAHwY/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




How to define a variable in Cakephp

2013-03-05 Thread Victor Musvibe
I trying to pass a variable in cakephp to a view and getting error 
Undefined variable: view [APP\View\ItQueries\add.ctp, line 9] and line 9 is 
this 

Form->hidden('status_type', array('value'=>$view)); ?>

Here is how im defining my variable in the controller

class ItQueriesController extends AppController {

var $view = 'Open';

public function index() {
$this->ItQuery->recursive = 0;
$this->set('view', $this->view);

}

//Other Code

}

and here is where im trying to pass the variable as a hidden field

Form->create('ItQuery'); ?>

Form->input('status_type', array('type' => 'hidden', 
'value'=>$view));
?>
Form->end(__('Submit')); ?>

Can some please show me how to fix this

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Changing table field using 2 different models

2013-03-05 Thread Victor Musvibe
I have an IT query system were by users can add their queries, when they 
add their query the IT department then replies/comments on the query. 

How is should work is when the user adds a query it must change the 
query_type field in the it_queries table to OPEN and when the IT department 
views the query they reply/comment on it and must change query_type field 
from OPEN to PENDING then finally when the user has been helped/assisted 
they should be able to mark the query as closed using a checkbox, that will 
then change the status from PENDING TO CLOSE.

Not sure if they is a way of setting the constants in the add views and 
insert in the table.

Obviously i am learning and can someone please guide me on the steps i must 
take.

Here is my code for the add it_query for the users

Form->create('ItQuery'); ?>


Form->hidden('hr_employee_id',array('value'=>$loggedInId));
echo $this->Form->input('it_query_type_id');
echo $this->Form->input('comment');
echo $this->Form->input('it_status_query_id');
?>

Form->end(__('Submit')); ?>

Here is the code for my comments for IT Department



Form->create
(
'Feedback.Comment',
array
(
'url' => array
(
'plugin' => 'feedback',
'controller' => 'comments',
'action' => 'add',
$foreign_model,
$foreign_id
)
)
);
?>
Form->input('Comment.author_name', array('label' => 
__('Name'))); ?>
Form->input('Comment.hairy_pot', array('type' => 
'hidden')); ?>
Form->input('Comment.content', array('label' => 
__('Comments'))); ?>
Form->input('Comment.foreign_model', array('type' => 
'hidden', 'value' => $foreign_model)); ?>
Form->input('Comment.foreign_id', array('type' => 
'hidden', 'value' => $foreign_id)); ?>
Form->end(__('Save comment')); ?>


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Send email when you edit a field in Cakephp

2013-03-03 Thread Victor Musvibe
I have employee application where users standing can be resigned, active, 
new and transferred. What i would like to achieve is that when the standing 
of an employee is changed/edited from active (standing_id = 1) it should be 
able to send through an email but its not. I have put a email function in 
the EmployeeController. Below is my code. 

function _sendNewEmployeeEditMail($id) {
$Employee = $this->Employee->read(null,$id);
$email = new CakeEmail();
$email->from(array('no-re...@test.com' => 'Testing App'));
$email->to(array('xxx...@gmail.com' => 'Name Surname'));
$email->subject('New Employee');
$email->template('employee_email');
$email->viewVars(compact('Employee'));
$email->emailFormat('html');
$_sendNewEmployeeEditMail = true;
$current_status = $this->Employee->field('standing_id');
if($current_status==1) {
$_sendNewEmployeeEditMail = false;
}
}

and in my edit save function here is how i am trying to send the email

public function edit($id = null) {
$this->Employee->id = $id;
if (!$this->Employee->exists()) {
throw new NotFoundException(__('Invalid employee'));
}
if ($this->request->is('post') || $this->request->is('put')) {
if ($this->Employee->save($this->request->data)) {
$this->Session->setFlash(__('The employee has been 
saved'),'default',array('class' => 'notification'));
$this->_sendNewEmployeeEditMail($this->Employee->getLastInsertID()  );
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The employee could not be saved. Please, 
try again.'),'default',array('class' => 'error'));
}
} else {
$this->request->data = $this->Employee->read(null, $id);
}
$standings = $this->Employee->Standing->find('list');
$this->set(compact('standings'));

If anyone could help me out on this, that would be awesome

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Utils Plugin for CakePHP not inserting records into table

2013-03-02 Thread Victor Musvibe
I am using the Utils Plugin for CakePHP on this link - 
https://github.com/CakeDC/utils. However the problem that i am having right 
now is that when i upload the csv its counting the correct number of 
records from my csv using setFlash e.g (Successfully imported 3 records 
from test.csv), but doesnt insert any records into the database. Does 
anyone have any idea on what might be causing this. I didnt change anything 
from the link provided.

Thanks in advance

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




How to echo and play videos in Cakephp

2013-02-28 Thread Victor Musvibe
I have an application were by users can upload images and should be able to 
echo and play videos. My upload function works fine but challenge that i am 
having now is to echo and play the video. Here is how i am uploading the 
file

function uploadFile() {
$file = $this->data['CpdVideo']['file'];
if ($file['error'] === UPLOAD_ERR_OK) {
$id = String::uuid();
if (move_uploaded_file($file['tmp_name'], WWW_ROOT . 'files/videos/' . 
$file['name'])) {
$this->request->data['CpdVideo']['filename'] = $file['name'];
$this->request->data['CpdVideo']['filesize'] = $file['size'];
$this->request->data['CpdVideo']['filemime'] = $file['type'];
return true;
}
}
return false;
}

Here is how i am saving the video

if ($this->uploadFile() && $this->CpdVideo->save($this->data))

This how i am trying to echo and play the video in my view.ctp

Html->media('files/videos'. 
$cpdVideo['CpdVideo']['filename'], array('fullBase' => true)); 

If any one could help me out that would be awesome

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Viewing 2 or more elements in the same view in Cakephp

2013-02-26 Thread Victor Musvibe
I am using Google API for displaying charts on my app. I am trying to view 
more than two elements on the same view page (index.ctp). Meaning i am 
trying to have more than 2 Charts on the same view page. The index page is 
only showing the policies_accessible2012.ctp element. 

Here is how i am calling the elements in my index.ctp




element('SurveyResults/2011/policies_accessible2011'); ?>

element('SurveyResults/2012/policies_accessible2012'); ?>




I do understand that if i have the following code, this will result in 
SurveyResults/2012/policies_accessible2012 rendered as the parent view to 
the current view

element('SurveyResults/2011/policies_accessible2011'); ?>
element('SurveyResults/2012/policies_accessible2012'); ?>

I am just wondering if they is a way to show the 2 or more elements on the 
same view. Thank you in advance

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Passing record from element to a view using different models

2013-02-22 Thread Victor Musvibe
Hi Bakers

I have an app were users can add their queries(ItQueries/add). When the IT 
department views the query (ItQueries/view/1) they should be able to 
comment/respond to it. What i have done so far is.

In the view of the IT query i have called an element for the IT department 
to add a response. below is how im calling the element

Element('/ItQueryResponses/add'); ?>

On submit of the ItQueryResponses i would like the action to redirect to 
the view page of the ItQueris with its comment underneath it.

Here is my code for my element

Form->create('ItQueryResponse', array('action' => 
'add')); ?>

Form->input('it_query_id');
echo $this->Form->input('response');
?>
Form->end(__('Submit')); ?>

Here is my add function for the ItQueryResponseController

public function add() {
if ($this->request->is('post')) {
$this->ItQueryResponse->create();
if ($this->ItQueryResponse->save($this->request->data)) {
$this->Session->setFlash(__('The it query response has been saved'));
$this->redirect(array('Controller' => 'ItQueryResponses', 'action' => 
'view'));
} else {
$this->Session->setFlash(__('The it query response could not be saved. 
Please, try again.'));
}
}
}

Here is my code for the ItQueryResponses view






 




 



If anyone can show me how i redirect to the ItQueryResponses view and have 
the ItQueryResponse underneath the view that would be awesome.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Inserting records into a table from an element

2013-02-21 Thread Victor Musvibe
Its now working create() method should be like this: 
$this->Form->create('ItQueryResponse', array('action' => 'add'));, 
otherwise the form submits to the view() method of your controller. 

On Thursday, 21 February 2013 09:07:51 UTC+2, Victor Musvibe wrote:
>
> Hi there 
>
> I have an element that i am calling with a view file. The element is a add 
> view that is add.ctp, challenge that im having now is that the element is 
> not inserting form input into the table (it_query_responses).
>
> here is how i am calling my element within the view - 
>
> Element('ItQueryResponses/add'); ?>
>
> and here is the code for the element 
>
> Form->create('ItQueryResponse'); ?>
> 
>  echo $this->Form->input('it_query_id');
> echo $this->Form->input('hr_employee_id');
> echo $this->Form->input('response');
> echo $this->Form->input('it_query_status_id');
> ?>
> Form->end(__('Submit')); ?>
> 
> and here is add function in ItQueryResponsesController
>
> public function add() {
> if ($this->request->is('post')) {
> $this->ItQueryResponse->create();
> if ($this->ItQueryResponse->save($this->request->data)) {
> $this->Session->setFlash(__('The it query response has been saved'));
> $this->redirect(array('action' => 'index'));
> } else {
> $this->Session->setFlash(__('The it query response could not be saved. 
> Please, try again.'));
> }
> }
> $itQueries = $this->ItQueryResponse->ItQuery->find('list');
> $hrEmployees = $this->ItQueryResponse->HrEmployee->find('list');
> $itQueryStatuses = $this->ItQueryResponse->ItQueryStatus->find('list');
> $this->set(compact('itQueries', 'hrEmployees', 'itQueryStatuses'));
> }
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Inserting records into a table from an element

2013-02-20 Thread Victor Musvibe
Hi there 

I have an element that i am calling with a view file. The element is a add 
view that is add.ctp, challenge that im having now is that the element is 
not inserting form input into the table (it_query_responses).

here is how i am calling my element within the view - 

Element('ItQueryResponses/add'); ?>

and here is the code for the element 

Form->create('ItQueryResponse'); ?>

Form->input('it_query_id');
echo $this->Form->input('hr_employee_id');
echo $this->Form->input('response');
echo $this->Form->input('it_query_status_id');
?>
Form->end(__('Submit')); ?>

and here is add function in ItQueryResponsesController

public function add() {
if ($this->request->is('post')) {
$this->ItQueryResponse->create();
if ($this->ItQueryResponse->save($this->request->data)) {
$this->Session->setFlash(__('The it query response has been saved'));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The it query response could not be saved. 
Please, try again.'));
}
}
$itQueries = $this->ItQueryResponse->ItQuery->find('list');
$hrEmployees = $this->ItQueryResponse->HrEmployee->find('list');
$itQueryStatuses = $this->ItQueryResponse->ItQueryStatus->find('list');
$this->set(compact('itQueries', 'hrEmployees', 'itQueryStatuses'));
}

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Passing form values from an element to a table in cakephp

2013-02-20 Thread Victor Musvibe
I have a IT query system where users add their queries. When i view the 
query i should be able to add a response to the query. The response should 
be added to table named it_query_responses and Model name is 
ItQueryResponse. 

Through an element i am including the add response in the view.ctp for the 
IT queries. Challenge that i am having now is that the element is not 
saving the response into the it_query_responses table.

Here is my add function for response controller

public function add() {
if ($this->request->is('post')) {
$this->ItQueryResponse->create();
if ($this->ItQueryResponse->save($this->request->data)) {
$this->Session->setFlash(__('The it query response has been saved'));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The it query response could not be saved. 
Please, try again.'));
}
}
$itQueries = $this->ItQueryResponse->ItQuery->find('list');
$hrEmployees = $this->ItQueryResponse->HrEmployee->find('list');
$itQueryStatuses = $this->ItQueryResponse->ItQueryStatus->find('list');
$this->set(compact('itQueries', 'hrEmployees', 'itQueryStatuses'));
}

and here is how i am calling my element after the closing div in view.ctp

element('ItQueryResponses/add'); ?>

here is the code for my element

Form->create('ItQueryResponse'); ?>


Form->input('it_query_id');
echo $this->Form->input('hr_employee_id');
echo $this->Form->input('response');
echo $this->Form->input('it_query_status_id');
?>

Form->end(__('Submit')); ?>


Thank you in advance.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Viewing a PDF file in Cakephp

2013-02-18 Thread Victor Musvibe
Hi Bakers

I am trying to view a PDF file within the body of my cakephp application 
after uploading it, more like an iframe. The upload works fine but the 
challenge that i have now is opening the pdf file.

Here is my upload function in my controller which is working fine

function uploadFile() {
$file = $this->data['QmsProcedureKnowledgeManagement']['file'];
if ($file['error'] === UPLOAD_ERR_OK) {
$id = String::uuid();
if (move_uploaded_file($file['tmp_name'], APP . 'qms_procedure_km/' . 
$file['name'])) {
$this->request->data['QmsProcedureKnowledgeManagement']['filename'] = 
$file['name'];
$this->request->data['QmsProcedureKnowledgeManagement']['filesize'] = 
$file['size'];
$this->request->data['QmsProcedureKnowledgeManagement']['filemime'] = 
$file['type'];
return true;
}
}
return false;
}

and here is how i am trying to view the pdfin view.ctp

Html->link(APP.'qms_procedure_km/'. 
$qmsProcedureKnowledgeManagement['QmsProcedureKnowledgeManagement']['filename']);
 
?>

Thank you in advance.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Cake PHP Search Component not working and giving an error

2013-02-18 Thread Victor Musvibe
Hi Euromark

I am using the search plugin on https://github.com/cakedc/search. I am
trying to search for records using the ID field only, that is if i type in
1 on my form input it must show a record with user ID 1. The challenge that
i am having now is when i specify that the input should be the id field,
the input field for the search functionality disappears on my index view,
strange thing is when i specify a different field name the input field
shows.

Below is my code for my Model

public $actsAs = array('Search.Searchable');

public $filterArgs = array(
'id' => array('type' => 'like', 'field' => 'ItSupportRequest.id'),
);

public function findByTags($data = array()) {
$this->Tagged->Behaviors->attach('Containable', array('autoFields'
=> false));
$this->Tagged->Behaviors->attach('Search.Searchable');
$query = $this->Tagged->getQuery('all', array(
'conditions' => array('Tag.name'  => $data['tags']),
'fields' => array('foreign_key'),
'contain' => array('Tag')
));
return $query;
}

public function orConditions($data = array()) {
$filter = $data['filter'];
$cond = array(
'OR' => array(
$this->alias . '.id LIKE' => '%' . $filter . '%',
));
return $cond;
}

and here is my controller code.

 public $components = array('Search.Prg');

public $presetVars = true; // using the model configuration

public function find() {
$this->Prg->commonProcess();
$this->paginate['conditions'] =
$this->ItSupportRequest->parseCriteria($this->passedArgs);
$this->set('articles', $this->paginate());
}

and in my index.ctp file i have this code.

Form->create('ItSupportRequest', array(
'url' => array_merge(array('action' => 'find'), $this->params['pass'])
));
echo $this->Form->label('Query ID:') . "";
echo $this->Form->input('name', array('div' => false, 'label' =>
false));

echo $this->Form->submit(__('Search'), array('div' => false));
echo $this->Form->end();
?>

Thanks

Victor

On Mon, Feb 18, 2013 at 1:10 PM, euromark  wrote:

> You would need to properly upgrade the component and make it work with
> your version of cake.
>
> I propose you try https://github.com/cakedc/search
> It is up to date, more sophisticated and does the job with less
> configuration
>
>
>
> Am Montag, 18. Februar 2013 09:43:46 UTC+1 schrieb Victor Musvibe:
>
>> Hi Bakers
>>
>> I implemented a search component from this url http://www.designaeon.com/
>> **cake-php-search-component/<http://www.designaeon.com/cake-php-search-component/>but
>>  I have a few problems. At first Cake didn’t recognize the component.
>> After I renamed search.php in SearchComponent.php
>>
>> I got another Error: Declaration of SearchComponent::initialize() should
>> be compatible with Component::initialize(**Controller $controller)
>> [APP/Controller/Component/**SearchComponent.php, line 40]
>>
>> Below is my code for SearchComponent
>>
>> > class SearchComponent extends Component {
>>
>> var $controller = null;
>>
>> function initialize(&$controller)
>> {
>> $this->controller = $controller;
>> }
>>
>> function getConditions(){
>> $conditions = array();
>> $data= empty($this->controller->**params['named']) ?
>> $this->controller->params['**url'] : $this->controller->params['**named']
>> ;
>> $this->controller->{$this->**controller->modelClass}->**schema();
>>
>> foreach($data as $key=>$value){
>> 
>> if(isset($this->controller->{$**this->controller->modelClass}-**>_schema[$key])
>> && !empty($value)){
>> switch($this->controller->{$**this->controller->modelClass}-**
>> >_schema[$key]['type']){
>> case "string":
>> $conditions[$this->controller-**>modelClass . "." .$key . " LIKE"]
>> = "%".trim($value)."%";
>> break;
>> case "integer":
>> $conditions[$this->controller-**>modelClass . ".&

Cake PHP Search Component not working and giving an error

2013-02-18 Thread Victor Musvibe
Hi Bakers

I implemented a search component from this url 
http://www.designaeon.com/cake-php-search-component/ but I have a few 
problems. At first Cake didn’t recognize the component. After I renamed 
search.php in SearchComponent.php 

I got another Error: Declaration of SearchComponent::initialize() should be 
compatible with Component::initialize(Controller $controller) 
[APP/Controller/Component/SearchComponent.php, line 40]

Below is my code for SearchComponent

controller = $controller;
}
   
function getConditions(){
$conditions = array();
$data= empty($this->controller->params['named']) ? 
$this->controller->params['url'] : $this->controller->params['named'] ;
$this->controller->{$this->controller->modelClass}->schema();  
foreach($data as $key=>$value){

if(isset($this->controller->{$this->controller->modelClass}->_schema[$key]) 
&& !empty($value)){

switch($this->controller->{$this->controller->modelClass}->_schema[$key]['type']){
case "string":
$conditions[$this->controller->modelClass . "." .$key . " LIKE"] = 
"%".trim($value)."%";
break;
case "integer":
$conditions[$this->controller->modelClass . "." .$key] =  $value;
break;
case "date":
if(isset($this->controller->params['named'][$key."_fromdate"])){
$from = date("Y-m-d", strtotime( 
$this->controller->params['named'][$key."_fromdate"] ));
$conditions[$this->controller->modelClass.".".$key." >="] = trim($from);
}
if(isset($this->controller->params['named'][$key."_todate"])){
$to = date("Y-m-d", strtotime($this->params['named'][$key."_todate"]));
$conditions[$this->controller->modelClass.".".$key." <="] = $to;
}
}
}
}
return $conditions;

}

}
?>

and in my index view i am using this code 


element('SearchForm/set_pagination_named');?>//set 
pagination named element
element('SearchForm/form') ?>//search form element

 


Paginator->sort('id');?>
 




 

 
Html->link(__('Edit', true), array('action' => 
'edit', $itSupportRequest['ItSupportRequest']['id'])); ?>
Html->link(__('Delete', true), array('action' => 
'delete', $itSupportRequest['ItSupportRequest']['id']), null, 
sprintf(__('Are you sure you want to delete # %s?', true), 
$itSupportRequest['ItSupportRequest']['id'])); ?>








I have created 2 Elements SearchForm/form.ctp and 
SearchForm/set_pagination_named.ctp

/*form.ctp*/


 Search params['controller'] ?>
Form->create(array('action' => 'index', 'type' => 
'GET')); ?>
Form->input('id', array( 
'label'=>'ID','type'=>'text'));
echo $this->Form->submit('Search',array('class'=>'button'));
?>
 
Form->end(); ?>



and here is my set_pagination_named.ctp

params['url']) || isset($this->params['named'])){
$data=isset($this->params['named'] ) && !empty($this->params['named']) 
? $this->params['named']:$this->params['url'];
$possibledata=array('id');//possible fields
foreach($data as $key=>$value){
if(in_array($key,$possibledata) && !empty($value)){
$data_arr[$key]=$data[$key];
}
} 
}
?>
Paginator->options(array(
'evalScripts' => true,
'url'=>$data_arr
));
?>

Thank you in advance.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Retrieving Records Based On Field In Related Model?

2013-02-16 Thread Victor Musvibe
I have an employees table with status that is active, new and resigned. In 
my drop down menu for the application i have all 3 different statuses that 
is active, new and resigned,now i wanna link to each different status, that 
is when i click on active it only shows me the active users in the employee 
table.

Please not status table is linked to the employees table.

Thank you in advance.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Echo a image in cakephp after uploading it

2013-02-14 Thread Victor Musvibe
You simply the best..Yes it works.

On Thu, Feb 14, 2013 at 11:46 AM, Marcus James  wrote:

> Html->image('logos/'. $logo['Logo']['filename']); ?>
>
>
>
>
>
>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Echo a image in cakephp after uploading it

2013-02-14 Thread Victor Musvibe
Hi Marcus

 I have changed my uploadFile function to

  function uploadFile() {
$file = $this->data['Logo']['file'];
if ($file['error'] === UPLOAD_ERR_OK) {
$id = String::uuid();
if (move_uploaded_file($file['tmp_name'], WWW_ROOT .
'img/logos/' . $file['name'])) {
$this->request->data['Logo']['filename'] = $file['name'];
$this->request->data['Logo']['filesize'] = $file['size'];
$this->request->data['Logo']['filemime'] = $file['type'];
return true;
}
}
return false;
}

and its uploading correctly to the webroot img folder using the filename.
Now im trying to echo the image in my view using

Html->image('logos'. $logo['Logo']['filename']); ?>

Still does not echo.

Any idea why it doesnt wanna work?

On Thu, Feb 14, 2013 at 11:32 AM, Marcus James  wrote:

> what you wrote above, are you saving 511ca905-f170-49d5-90a0-055083176c8c
> value?
>
>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Echo a image in cakephp after uploading it

2013-02-14 Thread Victor Musvibe
Hi Marcus

Please note that when saving the image in the logos folder its manually 
generating an ID which i use as a safe filesystem name for storage. 

This eliminates any issues that users may attempt to introduce with weird 
and potentially system-damaging filenames that would otherwise be directly 
stored on your filesystem.

So in my logos folder it saves an image as 
511ca905-f170-49d5-90a0-055083176c8c which is also the ID value in the 
database and the filename saves it as Jellyfish.jpg. 

Hope this makes sense.

Any idea on how i can fix this?

Thanks 

On Thursday, 14 February 2013 11:01:35 UTC+2, marco metal wrote:
>
> you should write :-
>
> Html->image('/logos/'. $logo['Logo']['filename']); ?>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Echo a image in cakephp after uploading it

2013-02-14 Thread Victor Musvibe
Hi Marcus

Please note that when saving the image in the logos folder its manually
generating an ID which i use as a safe filesystem name for storage.

This eliminates any issues that users may attempt to introduce with weird
and potentially system-damaging filenames that would otherwise be directly
stored on your filesystem.

So in my logos folder it saves an image as
511ca905-f170-49d5-90a0-055083176c8c which is also the ID value in the
database and the filename saves it as Jellyfish.jpg.

Hope this makes sense.

Any idea on how i can fix this?

Thanks

On Thu, Feb 14, 2013 at 11:01 AM, Marcus James  wrote:

> you should write :-
>
> Html->image('/logos/'. $logo['Logo']['filename']); ?>
>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Echo a image in cakephp after uploading it

2013-02-14 Thread Victor Musvibe
I am trying to echo an image after i upload to logos folder which is under 
the app folder. The uploading is working but the challenge that i have 
right now is to echo the image in the view. Below is my upload function and 
the view code

 function uploadFile() {
$file = $this->data['Logo']['file'];
if ($file['error'] === UPLOAD_ERR_OK) {
$id = String::uuid();
if (move_uploaded_file($file['tmp_name'], APP.'logos'.DS.$id)) {
$this->request->data['Logo']['filename'] = $file['name'];
$this->request->data['Logo']['filesize'] = $file['size'];
$this->request->data['Logo']['filemime'] = $file['type'];
return true;
}
}
return false;
}

and for the view code, i using this code.

Html->image(APP. 'logos' . DS. 
$logo['Logo']['filename']); ?>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




cakephp download hanging in browser

2013-02-07 Thread Victor Musvibe
I am trying to download a file thats already uploaded in cakephp app 
folder. I am using the function below in my controller but it just opens a 
blank page without even downloading the file

public function download($id = null) {
$this->viewClass = 'Media';
// Download app/outside_webroot_dir/example.pdf
$adminProcedure = $this->AdminProcedure->findById($id);
$filename = $adminProcedure['AdminProcedure']['filename'];
$this->request->params = array(
'id' => $adminProcedure['AdminProcedure']['id'],
'name' => substr($filename, 0, strrpos($filename, '.')),
'extension' => substr(strrchr($filename, '.'), 1),
'ext'=>'pdf',
'download' => true,
'path' => APP.'admin_procedures'.DS,
);
$this->set($params);
}


In my view i have used this bit of code to link to the file im trying to 
download.

?php echo $this->Html->link(__('Download', true), array('action' => 
'download', $adminProcedure['AdminProcedure']['id'])); ?>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Cakephp download function not working

2013-02-06 Thread Victor Musvibe
Hi lowpass

I managed to get the files to be uploaded into the admin_procedures folder
under my app folder and also insert into my table.The current problem that
im having now is when i try to download the file. Its giving me 2 errors

C:\xampp\htdocs\intraweb\app\admin_procedures\5113458e-9570-4f22-a1aa-07f483176c8c
was not found

and

Error: The requested address
'/intraweb/admin_procedures/download/5113458e-9570-4f22-a1aa-07f483176c8c'
was not found on this server.

Please not intraweb is the name of my application.

below is my code for the uploadFile and download functions

function uploadFile() {
  $file = $this->request->data['AdminProcedure']['file'];
  if ($file['error'] === UPLOAD_ERR_OK) {
$id = String::uuid();
if (move_uploaded_file($file['tmp_name'],
APP.'admin_procedures'.DS.$id)) {
  $this->request->data['AdminProcedure']['id'] = $id;
  $this->request->data['AdminProcedure']['user_id'] =
$this->Auth->user('id');
  $this->request->data['AdminProcedure']['filename'] = $file['name'];
  $this->request->data['AdminProcedure']['filesize'] = $file['size'];
  $this->request->data['AdminProcedure']['filemime'] = $file['type'];
  return true;
}
  }
  return false;
}

function download($id = null) {
$adminProcedure = $this->AdminProcedure->findById($id);
$this->viewClass = 'Media';
$filename = $adminProcedure['AdminProcedure']['filename'];
$this->set(array(
'id' => $adminProcedure['AdminProcedure']['id'],
'name' => substr($filename, 0, strrpos($filename, '.')),
'extension' => substr(strrchr($filename, '.'), 1),
'path' => APP.'admin_procedures'.DS,
'ext'=>'pdf',
'download' => true,
));
}

and here is my view file code where im trying to download the file -

Html->link(__('Download', true), array('action' =>
'download', $adminProcedure['AdminProcedure']['id'])); ?>

On Thu, Feb 7, 2013 at 2:32 AM, lowpass  wrote:

> It's not clear what you mean by "when i view the index.ctp manually
> its not inserting any record in the table". Is a record being added to
> the DB? If not, post your add() action in full.
>
> But before doing that, check that the file is being uploaded.
>
> if (!empty($this->request->data))
> {
> die(debug($this->request->data)); // or log it
>
> Make sure that the form create options include 'type' => 'file' if the
> file array isn't there.
>
> On Wed, Feb 6, 2013 at 3:37 AM, Victor Musvibe 
> wrote:
> > I am struggling with a download functionality for cakephp2.x. Here is
> what i
> > am trying to achieve.
> >
> > I am uploading my files to a folder named procedures_uploads after i
> upload
> > the file i should be able to download it.
> >
> > Currently when i upload the file from my add.ctp its not redirecting to
> the
> > index.ctp and when i view the index.ctp manually its not inserting any
> > record in the table . Below is my code for the download functionality and
> > the add function
> >
> > /** download functionality */
> >
> > function download($id = null) {
> > $adminProcedure = $this->AdminProcedure->findById($id);
> > $this->viewClass = 'Media';
> > $filename = $adminProcedure['AdminProcedure']['filename'];
> > $this->set(array(
> > 'id' => $adminProcedure['AdminProcedure']['id'],
> > 'name' => substr($filename, 0, strrpos($filename,
> > '.')),
> > 'extension' => substr(strrchr($filename,
> '.'),
> > 1),
> > 'path' => APP.'procedures_uploads'.DS,
> > 'ext'=>'pdf',
> > 'download' => true,
> >
> > )); }
> >
> > And this is how i am saving the data in my add function
> >
> > if ($this->uploadFile() &&
> > $this->AdminProcedure->save($this->request->data))
> >
> > Does anyone know how to solve this proplem?
> >
> > your assistance would be greatly appreciated.
> >
> > --
> > Like Us on FaceBook https://ww

Cakephp download function not working

2013-02-06 Thread Victor Musvibe
I am struggling with a download functionality for cakephp2.x. Here is what 
i am trying to achieve.

I am uploading my files to a folder named procedures_uploads after i upload 
the file i should be able to download it.

Currently when i upload the file from my add.ctp its not redirecting to the 
index.ctp and when i view the index.ctp manually its not inserting any 
record in the table . Below is my code for the download functionality and 
the add function

/** download functionality */

function download($id = null) {
$adminProcedure = $this->AdminProcedure->findById($id);
$this->viewClass = 'Media';
$filename = $adminProcedure['AdminProcedure']['filename'];
$this->set(array(
'id' => $adminProcedure['AdminProcedure']['id'],
'name' => substr($filename, 0, strrpos($filename, 
'.')),
'extension' => substr(strrchr($filename, '.'), 
1),
'path' => APP.'procedures_uploads'.DS,
'ext'=>'pdf',
'download' => true,

)); }

And this is how i am saving the data in my add function

if ($this->uploadFile() && 
$this->AdminProcedure->save($this->request->data))

Does anyone know how to solve this proplem?

your assistance would be greatly appreciated.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ACL - Error Messages after Add New User

2012-11-07 Thread Victor Musvibe
Hi Karthi

I have the same problem as the person who posted the errors. I truncated 
the the 2 tables and still doesn't work.

Do you perhaps have another solution to this?

Thanks 

Victor

On Wednesday, 21 March 2012 19:28:17 UTC+2, karthik wrote:
>
> First truncate all data's in GROUP and USER table then add data's once 
> again. 
> Make sure whether you have linked GROUP and USER model correctly using 
> $actsAs requester. and its relations GROUP hasMany USER and USER 
> belongsTo GROUP 
>
> -karthi 
>
> On Mar 18, 9:26 am, Passivhaus Experte  
> wrote: 
> > Hi, 
> > 
> > I'm a newbie. 
> > 
> > I use the CakePHP Version 2.1.0 and followed the following 
> descriptionhttp://
> book.cakephp.org/2.0/en/tutorials-and-examples/simple-acl-cont... 
> > 
> > Currently I'm at the point "Acts As a Requester" and have the source 
> > code added to the Models User and Group. Also, I've successfully created 
> > 3 groups. When I add a user to the User table the user is created, but 
> > in the table Aros was no record is added... 
> > 
> > I am a little puzzled, hope you can help me. 
> > 
> > Error Messages: 
> > 
> --
>  
>
> > 
> > Notice (8): Array to string conversion 
> > [CORE/Cake/Model/Datasource/DboSource.php, line 436] 
> > Code Context 
> > 
> > $sql=   'node' 
> > $params =   array( 
> > (int) 0 => array( 
> > ) 
> > ) 
> > $prepareOptions =   array() 
> > $this   =   object(Mysql) {} 
> > $query  =   object(PDOStatement) {} 
> > 
> > PDOStatement::execute() - [internal], line ?? 
> > DboSource::_execute() - CORE/Cake/Model/Datasource/DboSource.php, line 
> > 436 
> > DboSource::execute() - CORE/Cake/Model/Datasource/DboSource.php, line 
> > 403 
> > DboSource::fetchAll() - CORE/Cake/Model/Datasource/DboSource.php, line 
> > 646 
> > DboSource::query() - CORE/Cake/Model/Datasource/DboSource.php, line 588 
> > Model::__call() - CORE/Cake/Model/Model.php, line 776 
> > Aro::node() - CORE/Cake/Model/Behavior/AclBehavior.php, line 88 
> > AclBehavior::node() - CORE/Cake/Model/Behavior/AclBehavior.php, line 88 
> > AclBehavior::afterSave() - CORE/Cake/Model/Behavior/AclBehavior.php, 
> > line 106 
> > ObjectCollection::trigger() - CORE/Cake/Utility/ObjectCollection.php, 
> > line 130 
> > call_user_func - [internal], line ?? 
> > CakeEventManager::dispatch() - CORE/Cake/Event/CakeEventManager.php, 
> > line 246 
> > Model::save() - CORE/Cake/Model/Model.php, line 1730 
> > UsersController::add() - APP/Controller/UsersController.php, line 68 
> > ReflectionMethod::invokeArgs() - [internal], line ?? 
> > Controller::invokeAction() - CORE/Cake/Controller/Controller.php, line 
> > 488 
> > Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 103 
> > 
> > 
> --
>  
>
> > 
> > Database Error 
> > 
> > Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have 
> > an error in your SQL syntax; check the manual that corresponds to your 
> > MySQL server version for the right syntax to use near 'node' at line 1 
> > 
> > SQL Query: node 
> > 
> > Notice: If you want to customize this error message, create 
> > app/View/Errors/pdo_error.ctp 
> > Stack Trace 
> > 
> >  CORE/Cake/Model/Datasource/DboSource.php line 436 → 
> > PDOStatement->execute(array) 
> >  CORE/Cake/Model/Datasource/DboSource.php line 403 → 
> > DboSource->_execute(string, array) 
> >  CORE/Cake/Model/Datasource/DboSource.php line 646 → 
> > DboSource->execute(string, array, array) 
> >  CORE/Cake/Model/Datasource/DboSource.php line 588 → 
> > DboSource->fetchAll(string, array, array) 
> >  CORE/Cake/Model/Model.php line 776 → DboSource->query(string, 
> > array, Aro) 
> >  CORE/Cake/Model/Behavior/AclBehavior.php line 88 → 
> > Model->__call(string, array) 
> >  CORE/Cake/Model/Behavior/AclBehavior.php line 88 → Aro->node(array) 
> >  CORE/Cake/Model/Behavior/AclBehavior.php line 106 → 
> > AclBehavior->node(User, array, string) 
> >  [internal function] → AclBehavior->afterSave(User, boolean, array) 
> >  CORE/Cake/Utility/ObjectCollection.php line 130 → 
> > call_user_func_array(array, array) 
> >  [internal function] → ObjectCollection->trigger(CakeEvent) 
> >  CORE/Cake/Event/CakeEventManager.php line 246 → 
> > call_user_func(array, CakeEvent) 
> >  CORE/Cake/Model/Model.php line 1730 → 
> > CakeEventManager->dispatch(CakeEvent) 
> >  APP/Controller/UsersController.php line 68 → Model->save(array) 
> >  [internal function] → UsersController->add() 
> >  CORE/Cake/Controller/Controller.php line 488 → 
> > ReflectionMethod->invokeArgs(UsersController, array) 
> >  CORE/Cake/Routing/Dispatcher.php line 103 → 
> > Controller->invokeAction(CakeRequest) 
> >  CORE/Cake/Routing/Dispatcher.php line 85 → 
> > Dispatcher->_invoke(UsersCo