Jump to content

Iluvatar+

Members
  • Posts

    100
  • Joined

  • Last visited

Everything posted by Iluvatar+

  1. I was going to use Google analytics API to develop my cms dashboard content but i am unsure that it's the best way to go about it. Does anyone have any suggestions?
  2. I need to be able to select all fields that have a date thats passed. Any ideas?
  3. Has anyone ever done this?
  4. Thank you, i used hidden text boxes and used jquery to toggle it's value on a ifChecked event in the end.
  5. Yea but if it's returned false then teh value wont post and i need the 0 value in order to update a permission record in my table.
  6. Does anyone no a way to post a unchecked checkbox value?
  7. Clearly a relevant response to my question!?! :S
  8. Alright guys, Just wondering if anyone could give me a bit of advice. I am using a foreach with in a foreach to insert records in a table. This is the only solution i could come up up with for the nature of this function. I will try and explain as simple as possible... I needed to insert a set of records for each department, each set of records are based on how many franchise there is (with in a table). This is my code which is working fine, but i want to make sure it's the best way to go about this. (keep in mind i am using cakephp) <?php //... $this->loadmodel('Userdepartmentlink'); $this->loadmodel('Department'); /**/ $departments = $this->Department->find('all'); foreach($departments as $departments){ $department_id = $departments['Department']['id']; $this->loadmodel('Franchise'); /**/ $franchises = $this->Franchise->find('all'); foreach($franchises as $franchises){ $sets = array( array( 'user_id'=>'7', 'department_id'=>$department_id, 'franchise_id'=>$franchises['Franchise']['id'] ), ); if($this->Userdepartmentlink->saveAll($sets)) { echo "saved"; } else { echo "doesnt work"; } } ?>
  9. as in create a function called _construct?
  10. I get "Parse error: syntax error, unexpected T_IF, expecting T_FUNCTION in C:\wamp\www\NEW\cms\app\models\user.php on line 20" <?php class User extends AppModel { var $name = 'User'; var $validate = array( 'login' => array( 'rule' => array('_isUnique', 'login'), 'message' => 'Login name already taken.' ) ); /*---------------------------------------------------------------------------------------------------------------------- # Add user premisons model var $belongsTo = array('Userpagepremission' => array('className' => 'Userpagepremission', 'foreignKey' => false, 'conditions'=> array('Userpagepremission.user_id = User.id') ) ); -----------------------------------------------------------------------------------------------------------------------*/ if($this->action=='editprofile') { # This needs to be used for the image upload functionality. var $actsAs = array('Media.Transfer' => array('trustClient' => false, 'transferDirectory' => MEDIA_TRANSFER, 'createDirectory' => true, 'alternativeFile' => 100 ), 'Media.Coupler', 'Media.Generator' => array( 'baseDirectory' => MEDIA_TRANSFER, 'filterDirectory' => MEDIA_USER, 'createDirectory' => true, ), ); // file validation params (which only allowed jpeg and png to be uploaded) var $validate = array( 'file' => array( 'mimeType' => array( 'rule' => array('checkMimeType', false, array( 'image/jpeg', 'image/png')) ) ) ); } } ?>
  11. I apologize if i sounded rude, it wasn’t my intention. I have a user m/v/c, in my controller i currently have four action (login, logout, add, edit). Within the edit section i have an image uploaded component in use for the user avatar, however in the add user action i don’t want to have the same component in the form i just want to add content to specific fields in the record. In my model i have numerous parameters set in regards to the upload component, but when i am using the add user action the image uploader parameters seem to be stopping my action from inserting a new record. What i need is a condition that will allow me to run them parameters when necessary (with in the action that uses it - edit action). here is my code anyway... <?php class User extends AppModel { var $name = 'User'; # This needs to be used for the image upload functionality. var $actsAs = array('Media.Transfer' => array('trustClient' => false, 'transferDirectory' => MEDIA_TRANSFER, 'createDirectory' => true, 'alternativeFile' => 100 ), 'Media.Coupler', 'Media.Generator' => array( 'baseDirectory' => MEDIA_TRANSFER, 'filterDirectory' => MEDIA_USER, 'createDirectory' => true, ), ); // file validation params (which only allowed jpeg and png to be uploaded) var $validate = array( 'file' => array( 'mimeType' => array( 'rule' => array('checkMimeType', false, array( 'image/jpeg', 'image/png')) ) ) ); } ?>
  12. It's clearly self-explanatory
  13. If there any way of using if conditions with in a class but outside any actions with in that class. I need to say if current controller action is in use then use then set these vars else set another set of vars. Keep in mind i am using cakephp framework.
  14. Is it possible to have access controll on url parms. For example i have a CreatePage controller but each created page will have a franchise_id related to it and stored in it's table. I want to be able to allow and deny specific franchises within the CreatedPages controller. i.e: <?php if($this->action==Stepone/?fran_id=2){ if($this->Auth->user('role') == 'user') { return true; } else { ... ?>
  15. I have a isAuthorized function in cakephp and i need to be able to select some data and loop it with in the controller function. Is this possible, if so please share...
  16. Now this is driving me up the wall, as i cant see were i am going wrong. I am trying to set up a role permision in the isAuthorized function, i have got it working in regards to allowed pages, but any page that isn't allowed when a i try and gain unauthorized access it it is get stuck in a infinite loop redirect rather than just redirecting to the previous or login action. If any one can help me on this i would be a happy chap! Here is my code (both beging in the app controller) <?php function beforeFilter() { parent::beforeFilter(); $user = $this->Auth->user(); $this->set(compact('user')); $this->Auth->loginRedirect = array('controller' => 'User', 'action' => 'Registers'); $this->Auth->allow('Users'); $this->Auth->authorize = 'controller'; $this->Auth->loginError = "Error"; $this->Auth-> authError = "Error"; } function isAuthorized() { $this->Auth->autoRedirect = false; if($this->action=='stepone' || $this->action=='steptwo') { //$current_user_role = $session->read('Auth.User.role'); if($this->Auth->user('role') == 'user') { return true; } else{ //Redirect to error notification page $this->Session->setFlash('Sorry, you don\'t have permission to access that page.'); $this->redirect('login'); return false; } } parent::isAuthorized (); } ?> In the another controller [code] function beforeFilter() { parent::beforeFilter(); $this->Auth->deny('*'); //Disallow access to all actions } [/code]
  17. This is a long shot like seen as no one seems to respond to any cakephp related questions/problems. But anyway here it goes… I need to create a simple relationship between tables (User.id => Pages.user_id). I have created relationships before in cake but only in order to find and display data in the controller or the view. I need this specific relationship to be set in the model ‘User’, the reason why is that I want the Auth (current user) session to contain its foreign relations in order to use that related data to set permissions within the User controller. This is my model ATM class User extends AppModel { var $name = 'User'; var $belongsTo = array(Page => array('className' => Page, 'foreignKey' => user_id, ) ); From how I have read the syntax is fine, it’s just seems as though cake automatically assumes that the foreign key is within the user model rather than the pages model.
  18. I have been able to pass a value to the body of the parent document, however i am trying to target a specific element (textbox) Here is the code i have used so far <script type="text/javascript"> $(document).ready(function(){ $("#AvatarButton").one("click", function(){ var imgSrc = "<img src='http://www.pubcon.com/banners/hawaii1.jpg'>"; $("#StepWrapper", parent.document.body).append(imgSrc); }); }); </script>
  19. It's ok now i have found a solution. I just reloaded the Auth component data in my controller action
  20. I am using cakephp to develop a csm. I have a user controller with a edit profile action. The function it self works fine and it updates the database but when it returns to the view that displays the profile content from the db it shows only the out-dated data. Has anyone ran into this problem before?
  21. I am having a lot of trouble finding material to help me with this problem. I am using cakephp 1.2. What i want to be able to do is give users the ability to upload an avatar. For form is quite basic (takes the data and updates the corresponding record in the database) but I need to add in a file upload form object so the user can pick an image then i my code to be able to take that image and save it in multiple sizes and finally to save the image name and extension (ex: image.jpg) in to the database table. If anyone can help me with this it would be such a massive help.
  22. Any one got any decent image upload and resize codes they can through my way, preferably to work with cakephp??
  23. Has anyone had any experience with this? I have created the user login which redirects the user to the admin page, but what i then need to so is to have a user profile/settings section on the admin so it will recognize the user that’s logged on and give that user the ability to edit his profile (change details or password ect)
×
×
  • Create New...

Important Information

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