Re: Form Uploaded Image not exist when Edit form

2014-07-17 Thread CUCULEAC STEFAN
Hello Kimi.
What i did was to show the image if exist, when edit, and if you not upload 
other,do nothing:

Edit page
echo $this-Html-image(user_icons/.$photo, $options =  array('alt' = 
'Icon User', 'width' = '150px'));

echo $this-Form-input('User.photo', array('type' = 'file'));


UserController edit function
if ($this-request-is(array('post', 'put'))) {
$tmp_name = $this-request-data['User']['photo']['tmp_name'];
$filename = $this-code().'_'.$this-request-data['User']['photo']['name'];
$uploads_dir = WWW_ROOT.'img'.DS.'user_icons'.DS. $filename;
 $this-request-data['User']['photo'] = $filename;
//pr($this-request-data); die();
if ($this-User-save($this-request-data)) { 
move_uploaded_file($tmp_name, $uploads_dir);   
$this-Session-setFlash(__('The user has been saved.'));
return $this-redirect(array('action' = 'index'));
} else {
$this-Session-setFlash(__('The user could not be saved. Please, try 
again.'));
}
} else {

$options = array('conditions' = array('User.' . $this-User-primaryKey = 
$id));
$this-request-data = $this-User-find('first', $options);
$this-set('photo', $this-request-data['User']['photo']); 
}

Hope that help you.

Best Regards, Stefan

miercuri, 16 iulie 2014, 10:25:55 UTC+3, Kimi Sharma a scris:

 I have create form with some text field and one image field. It add 
 successfully after submit.

 but when i edit this form.. my form fields prefilled value exist of that 
 particular id (to which i edit) . but form image not show existing image 
 and request to enter new image. 

 kindly let me know solution. as i want to my previous image already 
 uploaded when i edit this form.. if i upload new then it replace. otherwise 
 same image uploaded.

 kindly revert asap. 


-- 
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/d/optout.


Get the base url in CakePHP

2014-07-17 Thread Ravi Saxena(Nethues)
if you do want to get the base url in Cakephp.

Use following code : 

*echo Router::url('/', true)* 

It will return exact website url of your website.



-- 
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/d/optout.


CakePHP 2.5 (linux) con SQLServer 2005

2014-07-17 Thread Franco Capra
Hola, trabajo en Ubuntu con cakephp 2.5 y necesito conectarme a una Base de 
Datos en un Servidor de Windows con SQLServer 2005. 
El problema es que desde el Framework no puedo conectarme, me muestra el 
siguiente Mensaje:

CakePHP is NOT able to connect to the database.
Datasource class SqlServer could not be found.

Y mi database es así:
public $default = array(
'datasource' = 'Database/SqlServer',
'persistent' = false,
'host' = '10.0.0.138',
'login' = 'sa',
'password' = 'sa',
'database' = 'SBDALCD3',
'prefix' = '',
//'encoding' = 'utf8',
);

La conexión al servidor la tengo habilitada ya que si me conecto con lo 
siguiente:
$usr = sa;
$psw = sa;
$server = 10.0.0.138;
$dbname = SBDALCD3;
$instance = SRVTESTBJRM03;
$link = mssql_connect($server, $usr,$psw);
if (!$link) {
echo'Could not connect';
die('Could not connect: ' . mssql_error());
}
echo'Successful connection';
mssql_close($link);

Me da éxito y puedo consultar las tablas.

Me estará faltando algún archivo en cakephp? (baje la version completa 
2.5) si alguno tiene idea de porque no puedo conectarme con cakephp a 
un sqlserver 2005 me daría una mano muy grande!!

Saludos!!!

-- 
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/d/optout.


Re: Data Validation: Checking if at least one field is populated and multiple rules not validating

2014-07-17 Thread seba
Thanks very much Stephen. I kept at it and found the solution lay in 
removing the 'required' and 'allowEmpty' from the 'needOne' ruleset, and 
adding a 'required' = false in the view. 

Here's the working solution for any one else with this problem:

The model:

public $validate = array(
'last_name'= array(
'needOne' = array (
'rule' = 'checkOne',
'message' = 'You must enter at least a contact name or email address.'
),
'alphaNumeric' = array(
'rule'   = 'alphaNumeric',
'message'  = 'Alphabets and numbers only',
'allowEmpty' = TRUE
),
'between' = array(
'rule'  = array('between', 2, 45),
'message' = 'Between 2 to 45 characters',
'allowEmpty' = TRUE
)
),
'email' = array(
'needOne' = array (
'rule' = 'checkOne',
'message' = 'You must enter at least a contact name or email address.'
),
'emailAddress' = array (
'rule' = 'email',
'message'  = 'A valid Email address is required',
'allowEmpty' = TRUE
)
)
);

// Ensure at least the last name or email field value is provided
public function checkOne($data) {
if(!empty($this-data[$this-alias]['last_name']) 
|| !empty($this-data[$this-alias]['email'])) {
return TRUE;
} else {
return FALSE;
}
} 


The view/fields (I'm using Bootstrap):

echo $this-Form-input('last_name', array(
'required' = false,
'fieldset' = false,
'label' = false,
'before' = 'label class=control-labelLast Name span 
class=one-required*/span/label',
'class' = 'form-control',
'placeholder' = 'Last Name',
'div' = 'form-group col-sm-12',
'error' = array(
'attributes' = array(
'wrap' = 'div', 
'class' = 'alert alert-danger'
)
)
)
);

echo $this-Form-input('email', array(
'required' = false,
'fieldset' = false,
'label' = false,
'before' = 'label class=control-labelEmail span 
class=one-required*/span/label',
'after' = '',
'class' = 'form-control',
'div' = 'form-group col-sm-12 col-xs-12',
'error' = array(
'attributes' = array(
'wrap' = 'div', 
'class' = 'alert alert-danger'
)
)
)
);

Thanks.

On Wednesday, 16 July 2014 00:44:50 UTC+10, seba wrote:

 Folks,

 I'm trying to ensure at least one of two fields (last_name or email) is 
 being populated. Each field also has multiple rules. I'm using CakePHP 
 version 2.4.2. 

 The problem I have at the moment, after multiple permutations of updating 
 and/or moving around the use 'last', 'allowEmpty', 'required', etc, is that 
 the fields just aren't validating at all, or aren't executing all the rules 
 when a field is populated.

 Any advice on how to modify the code below to achieve the following 
 behaviour is much appreciated:
 1. One of the two fields must be populated;
 2. The other rules attached to each field must validate as well (i.e. if a 
 last name is passed, then it must be between 2 and 45 chars and 
 alphanumeric only)

 Here's the model code:

 public $validate = array(
 'last_name'= array(
 'needOne' = array (
 'required' = FALSE,
 'allowEmpty' = TRUE,
 'last' = TRUE,
 'rule' = array('checkOne','last_name'),
 'message' = 'You must enter at least a contact name or email address.'
  ),
 'alphaNumeric' = array(
 'rule' = 'alphaNumeric',
 'message'  = 'Alphabets and numbers only'
 ),
 'between' = array(
 'rule' = array('between', 2, 45),
 'message' = 'Between 2 to 45 characters'
 )
 ),
 'email' = array(
 'needOne' = array (
 'required' = FALSE,
 'allowEmpty' = TRUE,
 'last' = TRUE,
 'rule' = array('checkOne','email'),
 'message' = 'You must enter at least a contact name or email address.'
  ),
 'emailAddress' = array (
 'last' = TRUE,
 'rule' = array('email', FALSE),
 'message'  = 'A valid Email address is required'
  )
 )
 );
  // Ensure at least the last name or email field value is provided
 function checkOne() {
 if(!empty($this-data[$this-User]['last_name']) || 
 !empty($this-data[$this-User]['email'])){
 return true;
 } else {
 return false;
 }
 }

 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.
For more options, visit https://groups.google.com/d/optout.


fatal error after baking application using cakephp 3.0

2014-07-17 Thread raji gudivada
Hi
  I am new to cakephp and i used baking concept for my tables. Now i got 
pages generated but i am unable to do edit and view actions.I am getting 
error as 
Unsupported operand types 
D:\xampp\htdocs\lib\Cake\View\Helper\FormHelper.php Line:1802. 
Please help me.


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.
For more options, visit https://groups.google.com/d/optout.


Re: fatal error after baking application using cakephp 3.0

2014-07-17 Thread José Lorenzo
That error does not correspond to CakePHP 3.0

What version are you actually using?

On Thursday, July 17, 2014 2:45:39 PM UTC+2, raji gudivada wrote:

 Hi
   I am new to cakephp and i used baking concept for my tables. Now i got 
 pages generated but i am unable to do edit and view actions.I am getting 
 error as 
 Unsupported operand types 
 D:\xampp\htdocs\lib\Cake\View\Helper\FormHelper.php Line:1802. 
 Please help me.


 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.
For more options, visit https://groups.google.com/d/optout.


Re: fatal error after baking application using cakephp 3.0

2014-07-17 Thread raji gudivada
Sorry i am using cakephp 2.5.o version

On Thursday, July 17, 2014 6:15:39 PM UTC+5:30, raji gudivada wrote:

 Hi
   I am new to cakephp and i used baking concept for my tables. Now i got 
 pages generated but i am unable to do edit and view actions.I am getting 
 error as 
 Unsupported operand types 
 D:\xampp\htdocs\lib\Cake\View\Helper\FormHelper.php Line:1802. 
 Please help me.


 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.
For more options, visit https://groups.google.com/d/optout.


Re: fatal error after baking application using cakephp 3.0

2014-07-17 Thread raji gudivada
Sorry @ jose Lorenzo
 My current version is cakephp 2.5.0.







-- 
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/d/optout.


Re: fatal error after baking application using cakephp 3.0

2014-07-17 Thread euromark
So what is in that line?
debug() it properly


Am Donnerstag, 17. Juli 2014 15:10:13 UTC+2 schrieb raji gudivada:

 Sorry @ jose Lorenzo
  My current version is cakephp 2.5.0.







-- 
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/d/optout.


Re: fatal error after baking application using cakephp 3.0

2014-07-17 Thread José Lorenzo
Please update to the lastest 2.5 version, what you experience is a known 
bug of that version

On Thursday, July 17, 2014 3:10:13 PM UTC+2, raji gudivada wrote:

 Sorry @ jose Lorenzo
  My current version is cakephp 2.5.0.







-- 
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/d/optout.


problem in sending pdf file as attchment on the fly

2014-07-17 Thread JAYESH TANK
Hello All,
I am facing one problem.
I want to send an email with attachment.
I have to  create a pdf file on the fly means on click of link -create pdf 
-send as an attchment. and it should be done using ajax.
I am using dompdf to create PDF file.
so is there any solution to achieve 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/d/optout.


Re: problem in sending pdf file as attchment on the fly

2014-07-17 Thread euromark
Dup 
of 
http://stackoverflow.com/questions/24804976/send-runtime-generated-pdf-in-attchment-in-email
It is still very unclear as it is currently asked


Am Donnerstag, 17. Juli 2014 15:08:13 UTC+2 schrieb JAYESH TANK:

 Hello All,
 I am facing one problem.
 I want to send an email with attachment.
 I have to  create a pdf file on the fly means on click of link -create 
 pdf -send as an attchment. and it should be done using ajax.
 I am using dompdf to create PDF file.
 so is there any solution to achieve 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/d/optout.


Re: Magic of UpdateAll

2014-07-17 Thread Maicon Pinto

This can help you?

$this-Picture-query(UPDATE User SET status='active';);


Em terça-feira, 17 de junho de 2014 09h10min30s UTC-3, સાદીકહસન પલસાણીયા 
escreveu:

 $this-loadModel('User');
 $this-User-updateAll(array('stauts'='active'),array());

 Above code equvivalent SQL query is generated like this

 UPDATE User SET status='active' WHERE 0 = 1;

 When I written updateAll in cakephp like below

 $this-loadModel('User');
 $this-User-updateAll(array('stauts'='active'));

 This code equvivalent SQL query is generated like this

 UPDATE User SET status='active';

 Why this happen I don't know. If I do not understand my question let me 
 know in comment. I explain in breif.


 Check reference : 
 http://stackoverflow.com/questions/24259110/magic-of-updateall?noredirect=1#comment37476920_24259110


-- 
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/d/optout.


How to calculate in array from $this-model-updateAll()?

2014-07-17 Thread Sam Clauw
I try to do an update all in my add action with the following method:

$this-CmsPage-updateAll(
 array(
 'CmsPage.rgt' = *('CmsPage.rgt' + 2)*
 ),
 array(
 'CmsPage.rgt ' = $right
 )
 );


Unfortunately, i'ts not working. It keeps sending the value 2 to the rgt 
field in my database table.
So my question is: what's should be changed in my array (2 + 'CmsPage.rgt) 
to do such calculations? :)

-- 
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/d/optout.


3.x - SecurityComponent and View Cell

2014-07-17 Thread mark_story
I don't think cells are going to be a good fit for either of these use cases. 
The general consensus on the github issse is that having cells be isolated is 
more useful than having them share state with the containing view scope.

-mark

-- 
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/d/optout.


Re: 3.x - SecurityComponent and View Cell

2014-07-17 Thread Thomas von Hassel
Yeah, it makes sense .. 
How about being able to give the cell a specific view in those cases where you 
know what you are doing ?

/thomas

On 18 Jul 2014, at 02:12, mark_story mark.st...@gmail.com wrote:

 I don't think cells are going to be a good fit for either of these use cases. 
 The general consensus on the github issse is that having cells be isolated is 
 more useful than having them share state with the containing view scope.
 
 -mark
 
 -- 
 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/d/optout.

-- 
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/d/optout.