Jump to content

Sradesign

Members
  • Posts

    67
  • Joined

  • Last visited

Posts posted by Sradesign

  1. I can see one inconsistency between my repeaters and what rayan always shows in the pictures screen_shot_2012-07-27_at_9_15_24_am.png

    this is rayan's one and in my case is like the below I mean the title of fields are with id and added _repeater I don't know if that make any difference or not but why is different.

    Untitled_2.jpg

  2. I still got the problem with repeaters can anyone help in that or I should go with pagefield which make my job harder to create the pages each time then import them to my user details pagefield. :D that's a bit ugly :D

  3. I did it @LostKobrakai but when I try to add them with api I have again issue I use a multiple select and send the page ID's and in processing part I do it like this but as you can see I get error.

    <?php
    	$input = wire('input');
    	$sanitizer = wire('sanitizer');
    	$roles = wire('roles');
    	$_POST = json_decode(file_get_contents('php://input'), true);
    
    	if($_POST['title']){
    		$task_title = $_POST['title'];
    	} else {
    		$task_title = '';
    	}
    	if($_POST['date']){
    		$task_date = $_POST['date'];
    	} else {
    		$task_date = '';
    	}
    	if($_POST['description']){
    		$task_description = $_POST['description'];
    	} else {
    		$task_description = '';
    	}
    	if($_POST['priority']){
    		$task_priority = $_POST['priority'];
    	} else {
    		$task_priority = '';
    	}
    	if($_POST['due']){
    		$task_due = $_POST['due'];
    	} else {
    		$task_due = '';
    	}
    	$task_person = $_POST['assigned'];
    	if($_POST['progress']){
    		$task_progress = $_POST['progress'];
    	} else {
    		$task_progress = '0';
    	}
    	
    	if(!empty($_POST)){
    		$task = new Page();
    		$task->template = 'task';
    		$task->parent = wire('pages')->get('/tasks/');
    		$task->save();
    		$task->title = $task_title;
    		$task->task_date = $task_date;
    		$task->task_description = $task_description;
    		$task->task_priority = $task_priority;
    		$task->task_due = $task_due;
    		$task->task_person->add($task_person);
    		$task->task_progress = $task_progress;
    		$task->page_roles = 'superuser';
    		$task->status = Page::statusHidden;
    		$task->save();
    		
    		$session->message(__('A New Task Successfully Added'));
    		$session->prevPage = $page;
    	}
    ?>
    

    test.jpg

  4. Kixe that doesn't work I tried see now in one task I have task_person = "sradesigns,ali" and in the other one I have task_person = "ali,sradesign" both are shown for user serdesign but not for ali which is wrong first of all it should show for both of them second of all it shouldn't show it to sradesign when is "sradesigns,ali" cause is not exactly sradesign and is sradesigns :D

  5. ok I think I mentioned wrong I have a page name Task which contain different task and each task has field like this task_person = "ali,sradesign,nona"

    the data for each task may vary then when I try to get all the tasks like this

    $tasks = $pages->find("parent=/tasks/,include=hidden,sort=-created");
    

    I want to have a filter here to check for it in one statement not to get all the tasks first then check for that.


    just to get the tasks that their task_person is equal too $user->name either ali or sradesign or nona.

  6. Hi

    I have another issue like always :D I have a field in my page details that contain comma separated values like this "ali,sradesign,nona" and now I want to get pages if $user->name is ali or sradesign or nona.

    What do you think guys how can I achieve this?

    Best Regards,

    Ali.M

  7. this will return RepeaterPageArray

    echo get_class($register->getFormatted(mt4));
    echo "<hr>";
    echo get_class($register->getUnformatted(mt4));
    

    and this one nothing :

    echo get_class($register->getFormatted(mt4)->count());
    echo "<hr>";
    echo get_class($register->getUnformatted(mt4)->count());
    
  8. I did try with $register like this:

    var_dump($register->getFormatted('mt4'));
    echo "<hr>";
    var_dump($register->getUnformatted('mt4'));
    

    and even like this:

    var_dump($users->get(1213)->getFormatted('mt4'));
    echo "<hr>";
    var_dump($users->get(1213)->getUnformatted('mt4'));
    

    both gives me thousand of line which is impossible to check.mind you I have 53 field in each user page.

  9. I have problem now with reading the data from repeater. see the below image my repeater have one entity now.

    mt4.jpg

    but when I try to read it like this :

    <table width="100%" id="registrations" class="table table-hover table-light dataTable dtr-inline" role="grid" aria-describedby="registrations_info" style="width: 100%;">
    <thead>
    <tr>
    	<th>VF-ID</th>
    	<th>Name</th>
    	<th>Family</th>
    	<th>Country</th>
    	<th>Phone</th>
            <th>MT4</th>
    	<th>Action</th>
    </tr>
    </thead>
    <tbody>
    <?php
         $registrations = $users->find("include=hidden,roles=member");
    	foreach($registrations as $register){
    ?>
    <tr>
    	<td><?php echo '<span class="badge badge-danger bg-blue btn-block">VF-' . $register->id . '</span>'; ?></td>
    	<td><?php echo $register->fname; ?></td>
    	<td><?php echo $register->lname; ?></td>
    	<td><?php echo $register->country_of_citizenship; ?></td>
    	<td><?php echo $register->phone; ?></td>
    	<td>
    	<?php 
    		foreach($register->mt4 as $mt4) {
    			echo $mt4->platform;
    		}
    	?>
            </td>
    	<td><?php echo '<a href="/user-details/id/'.$register->id.'" class="badge badge-danger bg-blue btn-block">Edit</a>'; ?></td>
    </tr>
    	<?php
            }
    	?>
    </tbody>
    </table>
    

    it shows nothing


    How can I access my repeater data it changed the name of nested fields by itself.

  10. Hi

    I have another problem like always :D I want to have a repetitive field for each user for example we call that field (MT) each user may have numbers of (MT) with different values in his account like:

    Name: client number 1   MT1: 1213 MT2: 1214

    Name: client number 2   MT1: 1216 MT2: 1217 MT3:1218

    Name: client number 3   MT1: 1216

    how to setup this scenario and how to add this MT's to user accounts like. and also how to get them in a loop.

  11. Since you asked for 'created' you can swap datefield in the example by  @Alxndre'  for created (we also have 'published')

    Yup, just like that. :)

    If your week starts on sunday

    $d = strtotime("today");
    $start_week = strtotime("last sunday midnight",$d);
    $end_week = strtotime("next saturday",$d);
    $start = date("Y-m-d",$start_week); 
    $end = date("Y-m-d",$end_week);  
    
    and then filter your pages like this:
    $results = $pages->find("datefield>=$start_week, datefield<=$end_week");
    
    where datefield is whatever date field you are trying to filter.

    Thank you all I did it like below :

    // Today Registrations
    $todaydate = strtotime("today");
    $today_registrations = $users->count('roles=member,created>='.$todaydate);
    
    // This Week Registrations		
    $weekdate = strtotime("last sunday midnight",$todaydate);
    $week_registrations = $users->count('roles=member,created>='.$weekdate);
    
    • Like 1
  12. Hi

    I'm trying to find a way to show pages detail based on filtered date for example I want to get the pages that created this week how to achieve this with selector? mind you I'm not looking for past 7 days I want for the current week.

    Best Regards,

    Ali.M

×
×
  • Create New...