This topic is locked

Show master table entries only if slave table has a corresponding entr

5/29/2008 9:33:59 AM
PHPRunner General questions
T
thesofa author

Hi

I am using 3 tables, staff and pupils and reports

the db is for staff to write reports about the pupils.

2 sets of staff can use it: tutors, who only see their tutor group members, and

Management team who can see all pupils, cannot add reports but can edit all reports.

900 kids in school, management staff not too bright about using the search functions, so I want to show only those pupils in the pupils list, who have already had a report written for them.

I can see a couple of ways so far, one being a `where` clause added to the sql query along the lines of 'where count ["reports"]>0'

I was after a more elegant solution using group permissions and a strip of code used as the sql query is run, can you help please?

J
Jane 5/30/2008

Hi,
here are some tips:

  1. edit list page in HTML mode on the Visual Editor tab.

    Here is a sample:
    <!--{foreach from=$rowinfo item=row}-->

    {if $row.showrecord}

    <TR onmouseover="this.className = 'rowselected';"

    onmouseout="this.className = '{$row.shadeclassname}';" vAlign=top

    {$row.rowstyle} {$row.shadeclass}>

    ...

    </TR>

    {/if}

    <!--{/foreach}-->


2. check number of records in the detail page for each record in the List page: After record processed event:

All field values of current record are stored in the $data array. Then assign correct value (True or False) to the new showrecord variable:

$row["showrecord"]=True;

T
thesofa author 5/30/2008

OK, I follow the system, but do I use one, or the other, or both?

T
thesofa author 6/2/2008

OK, I follow the system, but do I use one, or the other, or both?



bump

J
Jane 6/4/2008

Hi,
you can use any method you want.